Remove Dashboard from My Account Menu

I have a detailed tutorial about my account menu in WooCommerce on my blog and there you can find a chapter about removing menu links.

But the thing is that you can not just remove any link that easy. The problems may appear if you would like to remove “Dashboard” from my account menu.

So our goal for this tutorial is not only to remove a “Dashboard” menu link but also to perform a redirect to the next menu link. It is “Orders” by default.

I hope it is crystal clear why we need a redirect. Let’s imagine a situation when a customer signs in to your WooCommerce website. What My Account page will be displayed by default? Right. Besides, wp_get_page_permalink( 'myaccount' ) is probably used in your theme files, this function also sends users to the Dashboard page! So I think it is not enough just to redirect users after signing in, we should redirect them every time they are trying to access the Dashboard.

Remove Dashboard from my account menu in WooCommerce
“Orders” page will be opened by default every time customers go to “My account”.

Below is ready to use code snippet that allows to achieve that. You can insert it to your current theme functions.php, but please be aware of theme updates and child themes.

/**
 * @snippet       Remove Dashboard from My Account
 * @author        Misha Rudrastyh
 * @link          https://rudrastyh.com/woocommerce/remove-dashboard-from-my-account-menu.html
 */
// remove menu link
add_filter( 'woocommerce_account_menu_items', 'misha_remove_my_account_dashboard' );
function misha_remove_my_account_dashboard( $menu_links ){
	
	unset( $menu_links[ 'dashboard' ] );
	return $menu_links;
	
}
// perform a redirect
add_action( 'template_redirect', 'misha_redirect_to_orders_from_dashboard' );
function misha_redirect_to_orders_from_dashboard(){
	
	if( is_account_page() && empty( WC()->query->get_current_endpoint() ) ){
		wp_safe_redirect( wc_get_account_endpoint_url( 'orders' ) );
		exit;
	}
	
}

Some notes related to the code above:

Misha Rudrastyh

Misha Rudrastyh

Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.

Need some developer help? Contact me

Follow me on Twitter