Skip to content

New and Fresh Private + Public Proxies Lists Everyday!

Get and Download New Proxies from NewProxyLists.com

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, 2021Tags account, custom, home, Isnt, offtopic, page, Tab, WooCommerce, working

Post navigation

Previous Previous post: linux – (ROOTED PHONE) Using WiFi and LTE Simultaneously
Next Next post: algebra precalculus – How to find the complement of the domain from $f(x)=sec frac{pi}{3}-csc^2 4x$?
New and Fresh Private + Public Proxies Lists Everyday! 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