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!
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; }
Hello Rodolfo Melogli, you’re Gem man!! love your coding and your techniques. It helps me a lot to become a good wp developer 🙂
Great!
Hi,
Very good article BUT if i like to redirect to Dashboard Order Page ONLY the Shop Manager Users
Regards,
Pete
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
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.
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 🙂
This is so simple and very useful. Thank you Rodolfo 🙂
Awesome!
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?
Hey Richard, thanks for your comment! This is to redirect the website admin, not the customers 🙂