Tuesday, January 31, 2023
HomeWordPress DevelopmentTake away My Account Menu objects in Woocommerce based mostly on person...

Take away My Account Menu objects in Woocommerce based mostly on person roles


I would like to have the ability to unset or disable sure Myaccount menu objects in Woocommerce Dashboard based mostly on person position. So for instance present “orders” menu for purchasers (position) and never present menu “orders” for subscribers (position). Undecided of the easiest way to try this. I exploit the code in plugin known as “Code Snippets” in WordPress.

add_filter ( 'woocommerce_account_menu_items', 'silva_remove_my_account_links' );
operate silva_remove_my_account_links( $menu_links ){
 
    unset( $menu_links['downloads'] ); // Disable Downloads

    // If you wish to take away any of the opposite default hyperlinks, simply uncomment out the objects under:

    //unset( $menu_links['edit-address'] ); // Addresses
    //unset( $menu_links['dashboard'] ); // Take away Dashboard
    //unset( $menu_links['payment-methods'] ); // Take away Fee Strategies
    //unset( $menu_links['orders'] ); // Take away Orders

    //unset( $menu_links['edit-account'] ); // Take away Account particulars tab
    //unset( $menu_links['customer-logout'] ); // Take away Logout hyperlink
 
    return $menu_links;
 
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments