Adding additional items to My Account page
-
Hello,
We are building a website with wooCommerce on which only registered users are authorized to see certain content.
To do this we just set the pages to we want to hide to private/password protected.
Everything works fine so far, the pages are hidden until we login.Now we’re trying to add additional links to our My Account menu list on the left side.
We followed this tutorial >>> https://github.com/woocommerce/woocommerce/wiki/Customising-account-page-tabs
We were able to display the link on the menu “my-custom-endpoint” but the link directs the user to the protected page in a logged out mode when the user is logged in. We need the user to be able to view the protected pafe with no issues by linking to it from My Account page, why is the link directing the user to this page and displays login page?
Has anyone else encountered this problem?
Below is the code with used
`
/**
* Insert the new endpoint into the My Account menu.
*
* @param array $items
* @return array
*/
function my_custom_my_account_menu_items( $items ) {
// Remove the logout menu item.
$logout = $items[‘customer-logout’];
unset( $items[‘customer-logout’] );
$viewitems =$items[”];
// Insert your custom endpoint.
$items[‘my-custom-endpoint’] = __( ‘https://dropido.com/dropship-products/’, ‘woocommerce’ );// Insert back the logout item.
$items[‘customer-logout’] = $logout;return $items;
}add_filter( ‘woocommerce_account_menu_items’, ‘my_custom_my_account_menu_items’ );
- The topic ‘Adding additional items to My Account page’ is closed to new replies.