Skip to content

Proxies-free.com: 100% Free Daily Proxy Lists Every Day!

Get Free Proxies Every Day

woocommerce offtopic – Custom My Account tab isn’t working when Home Page is My Account page

I have used the code snippet to add the custom my account page:

/**
 * Register new endpoint to use inside My Account page.
 *
 * @see https://developer.wordpress.org/reference/functions/add_rewrite_endpoint/
 */
function my_custom_endpoints() {
    add_rewrite_endpoint( 'my-custom-endpoint', EP_ROOT | EP_PAGES );
}

add_action( 'init', 'my_custom_endpoints' );

/**
 * Add new query var.
 *
 * @param array $vars
 * @return array
 */
function my_custom_query_vars( $vars ) {
    $vars() = 'my-custom-endpoint';

    return $vars;
}

add_filter( 'query_vars', 'my_custom_query_vars', 0 );

I’ve followed this documentation: https://github.com/woocommerce/woocommerce/wiki/Customising-account-page-tabs

and also added a new custom tab Title and Content which works fine.

However, when the home page is myaccount page.

enter image description here

the new account tab do not work anymore. It leads to the blog posts page.

Basically, the URL:

http://development.local/downloads/
http://development.local/edit-account/

works fine.

http://development.local/my-custom-endpoint/

doesnot.

When myaccount tab is not homepage:

http://development.local/my-account/my-custom-endpoint/
http://development.local/my-account/downloads/
http://development.local/my-account/edit-account/

all works fine.

I’ve already tried flushing the permalinks.

Thank you!

Author AdminPosted on April 2, 2021Categories ArticlesTags account, custom, home, isnt, offtopic, page, tab, woocommerce, working

Post navigation

Previous Previous post: drivers – Laptop keyboard typing + on its own
Next Next post: unity – How to produce interreflections in Unity3d?
Proxies-free.com: 100% Free Daily Proxy Lists Every Day! Proudly powered by WordPress

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123