Is it possible to change the Default “Home” admin page when logging into the WordPress Dashboard?
I thought about a couple of possibilities…
- Substitute the content on the Dashboard home page with custom
content. - Redirect to a different admin page within the WordPress Dashboard
upon successful login.
If it is possible to do either of the two options, what hooks would you recommend utilizing?
1
Easy enough, decided to just do the redirect option. I used the wp_login
action hook. You could also probably use this for redirecting your users to ANY page on your website. You can also check user capabilities from the $user
Object passed in as a function parameter if you want to send different user levels to different pages.
/* Redirect the user logging in to a custom admin page. */
function new_dashboard_home($username, $user){
if(array_key_exists('administrator', $user->caps)){
wp_redirect(admin_url('admin.php?page=c2c-overview', 'http'), 301);
exit;
}
}
add_action('wp_login', 'new_dashboard_home', 10, 2);