I've been trying to get this to work on my account pages, wanted to add a "Membership" tab under my accounts page for WooCommerce, but when i click on the custom tabs I created, it shows a "page does not exist error message" as such.
This is what it looks like on the my-account page. Basically wanted the custom content to display when user click onto the custom tab, like the following. This is just an example for My Orders Tab.
Any Idea what could have gone wrong here? I am using the following action hooks to create the custom tab. Code added to my "functions.php" file of my child theme.
function bbloomer_add_custom_endpoint() {
add_rewrite_endpoint( 'membership', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'bbloomer_add_custom_endpoint' );
function bbloomer_membership_query_vars( $vars ) {
$vars[] = 'membership';
return $vars;
}
add_filter( 'query_vars', 'bbloomer_membership_query_vars', 0 );
function bbloomer_add_membership_link_my_account( $items ) {
$items['membership'] = 'Membership';
return $items;
}
add_filter( 'woocommerce_account_menu_items', 'bbloomer_add_membership_link_my_account' );
function bbloomer_membership_content() {
echo '<h3>Membership Custom Tab </h3><p>Welcome to the Membership area.</p>';
//echo do_shortcode( ' /* your shortcode here */ ' );
}
add_action( 'woocommerce_account_membership_endpoint', 'bbloomer_membership_content' );
Credit to @Dario Ferrer answer code from 2016-06-27 that inspired Business Bloomer code
And I dont think adding a seperate page such as "https://mydomain/my-account/membership/" would help with this too.

