I am working on a project where my account page is a homepage. So what I did I have created a page that holding the shortcode [woocommerce_my_account]
and made this page homepage from Dashboard->Settings->Reading. Everything works. I have this working endpoints too:
- mydomain.com/orders
- mydomain.com/edit-address
But I am facing trouble when I am making a custom myaccount endpoint. I am doing it in this traditional way:
add_action('woocommerce_account_custom-endpoint_endpoint', function(){
echo 'hello';
} );
add_action('init', function() {
add_rewrite_endpoint('custom-endpoint', EP_ROOT | EP_PAGES);
});
But mydomain.com/custom-endpoint is not pointing to my account page, it is pointing to the index.php or page.php (WordPress template hierarchy).
I am curious to know why it is happening?