I'm working on a project that uses both SenseiLMS and Woocommerce. I can't get rid of some automaticly added nav elements. How it looks
The text in english is what I can't unset. What I tried so far:
add_filter( 'woocommerce_account_menu_items', 'taxguru_remove_my_account_links' );
function taxguru_remove_my_account_links( $menu_links ){
unset( $menu_links[ 'members-area' ] );
unset( $menu_links[ 'teams' ] );
return $menu_links;
}
`
$menu_link content -Those items I want to delete are not there. So i assume they have to be added later by something?
CodePudding user response:
you can use code like this to unset menu. Also please make sure about slug.
add_filter( 'woocommerce_account_menu_items', 'ak_remove_my_account_links' );
function ak_remove_my_account_links( $menu_links ){
unset( $menu_links[ 'edit-address' ] ); // Addresses
//unset( $menu_links[ 'dashboard' ] ); // Remove Dashboard
//unset( $menu_links[ 'payment-methods' ] ); // Remove Payment Methods
//unset( $menu_links[ 'orders' ] ); // Remove Orders
//unset( $menu_links[ 'downloads' ] ); // Disable Downloads
//unset( $menu_links[ 'edit-account' ] ); // Remove Account details tab
//unset( $menu_links[ 'customer-logout' ] ); // Remove Logout link
return $menu_links;
}
CodePudding user response:
Change the priority.
function taxguru_remove_my_account_links( $menu_links ){
unset( $menu_links[ 'members-area' ] );
unset( $menu_links[ 'teams' ] );
return $menu_links;
}
add_filter( 'woocommerce_account_menu_items', 'taxguru_remove_my_account_links', 9999 );