Home » WooCommerce: Set Default Dashboard Login Page to “Products”

WooCommerce: Set Default Dashboard Login Page to “Products”

by adminkys

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        Get tutoraspire.com FREE
 * @sourcecode    https://tutoraspire.com/?p=108166
 * @author        Tutor Aspire
 * @compatible    WooCommerce 3.5.4
 * @donate $9     https://www.tutoraspire.com
 */ 

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

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

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

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

You may also like