WooCommerce: Add New Tab in My Account Page (Custom Endpoint)

How to Add a New Tab @ WooCommerce My Account Page
function bbloomer_add_premium_support_endpoint() {
    add_rewrite_endpoint( 'my-ads', EP_ROOT | EP_PAGES );
add_action( 'init', 'bbloomer_add_premium_support_endpoint' );

// 2. Add new query var
function bbloomer_premium_support_query_vars( $vars ) {
    $vars[] = 'my-ads';
    return $vars;
add_filter( 'query_vars', 'bbloomer_premium_support_query_vars', 0 );

// 3. Insert the new endpoint into the My Account menu
function bbloomer_add_premium_support_link_my_account( $items ) {
    //$items['my-ads'] = 'My Ads';

	$myitems = array('my-ads' => 'My Ads');
	$items = array_slice( $items, 0, 1, true ) +   $myitems +   array_slice( $items, 1, count( $items ), true );
    return $items;
add_filter( 'woocommerce_account_menu_items', 'bbloomer_add_premium_support_link_my_account' );

// 4. Add content to the new tab
function bbloomer_ads_content() {
   echo '<h3>Your ads</h3>';'
   echo 'your content';
add_action( 'woocommerce_account_my-ads_endpoint', 'bbloomer_ads_content' ); 
After adding this woocommerce custom end point in my account page. Please save the permalinks again Enjoy!

Share this post:

Share on facebook
Share on twitter
Share on linkedin
Share on email
Amitpal Singh
Amitpal Singh
Freelance website and application developer. Working from Sangrur Punjab in India.
Follow Amitpal on:


Create your account and post ad