User Registration

  1. Home
  2. Docs
  3. User Registration
  4. How to?
  5. How to add additional tabs in my account

How to add additional tabs in my account

We have user_registration_account_menu_items filter hook to add the item to the $items array.

add_filter( 'user_registration_account_menu_items', 'ur_custom_menu_items', 10, 1 );
function ur_custom_menu_items( $items ) {
    $items['new-item'] = __( 'New', 'user-registration' );
    return $items;
}

Adding a new endpoint:

add_action( 'init', 'user_registration_add_new_my_account_endpoint' );
function user_registration_add_new_my_account_endpoint() {
    add_rewrite_endpoint( 'new-item', EP_PAGES );
}

Adding content to a new end point:

function user_registration_new_item_endpoint_content() {
    echo 'Your new content';
}
add_action( 'user_registration_account_new-item_endpoint', 'user_registration_new_item_endpoint_content' );

You can also add the contents from the template file. Create a template in wp-content/themes/your-chosen-theme/user-registration/myaccount/new-item.php and add the content here.
For this your user_registration_new_item_endpoint_content() callback function should point to your template file.

function user_registration_new_item_endpoint_content() {
      ur_get_template( 'myaccount/new-item.php');
}

Also, you can left the endpoint empty from User Registration->Settings->Geneal to hide the default tabs.

Was this article helpful to you? Yes No

How can we help?