$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>php - Woocommerce remove menu item on myaccount dashboard|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - Woocommerce remove menu item on myaccount dashboard

matteradmin10PV0评论

I'm doing a redesign of the woocommerce dashboard.

I had copy the dashboard.php from woocommerce folder to my theme folder.

So now I want to get rid of the side menu from dashboard only(Remain on other pages eg. account detail page)

Tried this code in dashboard.php, doesn't work.

add_filter ( 'woocommerce_account_menu_items', 'remove_my_account_links' );
function remove_my_account_links( $menu_links ){

    unset( $menu_links['edit-address'] );


    return $menu_links;

}

Understand this should be in function.php, but I only want to remove it from dashboard. How should I do that?

I'm doing a redesign of the woocommerce dashboard.

I had copy the dashboard.php from woocommerce folder to my theme folder.

So now I want to get rid of the side menu from dashboard only(Remain on other pages eg. account detail page)

Tried this code in dashboard.php, doesn't work.

add_filter ( 'woocommerce_account_menu_items', 'remove_my_account_links' );
function remove_my_account_links( $menu_links ){

    unset( $menu_links['edit-address'] );


    return $menu_links;

}

Understand this should be in function.php, but I only want to remove it from dashboard. How should I do that?

Share Improve this question asked Oct 22, 2018 at 9:10 Ng WilsonNg Wilson 111 silver badge4 bronze badges 2
  • You need to place this snippet in your child theme's functions.php – Akshat Commented Oct 22, 2018 at 14:43
  • @Akshat The problem is it will remove the menu item on all my account pages, but I just need that to be remove on dashboard. – Ng Wilson Commented Oct 23, 2018 at 1:44
Add a comment  | 

2 Answers 2

Reset to default 0

You can override the dashboard.php template by copying it over to /your-theme/woocommerce/myaccount/dashboard.php.

From there it should be easy to customize it to your needs.

Thanks everyone I have solved this..

On myaccount.php remove

do_action( 'woocommerce_account_navigation' );

also remove if you want your content to be on the center of pages

<div class="woocommerce-MyAccount-content"></div>

then, on my-order.php, edit-address.php etc add in above code in the correct position, then upload to your theme folder so any update of woocommerce won't override this change

Post a comment

comment list (0)

  1. No comments so far