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 CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=108166
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.4
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */ 

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;
}

Share:

Leave a Reply