WooCommerce: Set Default Dashboard Login Page to “Products”

When you log in to the WordPress dashboard and WooCommerce is active, you might want to be redirected to a different page rather than the default “Dashboard” one.

For example, you might want to go directly to the “Products” admin page, or maybe to the “WooCommerce > Orders” page. Or, if you are like me on my development website, you want to go straight to the WordPress editor’s functions.php file 😀

Either way, saving time on login is what we’re chasing here. Pick your default login page, and then use the two snippets below to target actual logins and direct accesses to wp-admin. Enjoy!

Redirecting dashboard logins to the WooCommerce “Products” admin page

Snippet (PHP): Redirect Dashboard Login to “Products” Page @ WordPress/WooCommerce Admin


/**
 * @snippet       Default Dashboard Page @ WP Admin
 * @how-to        businessbloomer.com/woocommerce-customization
 * @sourcecode    https://businessbloomer.com/?p=108166
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 3.5.4
 * @community     https://businessbloomer.com/club/
 */ 

add_action( 'load-index.php', 'bbloomer_direct_access_wp_dashboard_redirect' );

function bbloomer_direct_access_wp_dashboard_redirect(){
	wp_redirect( admin_url( 'edit.php?post_type=product' ) );
}

add_filter( 'login_redirect', 'bbloomer_login_wp_dashboard_redirect', 9999, 3 );

function bbloomer_login_wp_dashboard_redirect( $redirect_to, $request, $user ){
	$redirect_to = admin_url( 'edit.php?post_type=product' );
	return $redirect_to;
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

10 thoughts on “WooCommerce: Set Default Dashboard Login Page to “Products”

  1. Hello Rodolfo Melogli, you’re Gem man!! love your coding and your techniques. It helps me a lot to become a good wp developer 🙂

    1. Great!

  2. Hi,

    Very good article BUT if i like to redirect to Dashboard Order Page ONLY the Shop Manager Users

    Regards,
    Pete

    1. Hey Pete, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  3. Great post! Please confirm how to modify the code to set the Default Dashboard Login Page to other pages, like orders. I’m thinking we simply change the post_type=, such as orders is “shop_order”
    Thank you.

    1. Ken, thanks for your comment! Just get the URL of the page you want to set from the browser itself, and then enter it inside the snippet 🙂

  4. This is so simple and very useful. Thank you Rodolfo 🙂

    1. Awesome!

  5. This is so convenient. Thanks for the code 🙂
    How can I make them redirect to their current page? For both login and register pages?

    Example. I am browsing a product and i want to loging/register to buy it, and after be directed to same page i was looking at?

    1. Hey Richard, thanks for your comment! This is to redirect the website admin, not the customers 🙂

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *