How to change the WordPress admin home page

By mark.ashton
July 1, 2023

There is no default in WordPress to change the admin home page, it will always go to the standard dashboard page. In this article we will show you two ways of doing this, one with code and one using uiPress Pro.

With uiPress Pro

To set the home page for a user role using uiPress pro, you will first need to enable the user management features, you can see how to do that here.

Once on the user management page, select the role you want to set a redirect for and you will see the login redirect / homepage option:

Here we have set the login redirect to be users.php (the main users page). Hit save and your new redirect is ready to go. After logging in users with the role will be redirected to the page you chose and when visiting yoursite.com/wp-admin you will be redirected to the page as well.

With code

A similar thing can also be achieved with a small amount of PHP code added to your functions.php file or using a code snippet plugin. Adding the following code will redirect all users to the users.php page:

//Login redirect
function redirect_on_login($user_login, $user)
{
  $userRedirect = 'users.php';
  $url = admin_url($userRedirect);
  wp_safe_redirect($url);
  exit();
}
add_filter('wp_login', 'redirect_on_login', 10, 2);

//Catch requests to the admin home page
function redirect_on_home()
{
  $currentURL = home_url(sanitize_url($_SERVER['REQUEST_URI']));
  $adminURL = get_admin_url();

  //Only redirect if we are on empty /wp-admin/
  if ($currentURL != $adminURL) {
    return;
  }

  $userRedirect = 'users.php';
  $url = admin_url($userRedirect);
  wp_safe_redirect($url);
  exit();
}
add_filter('admin_init', 'redirect_on_home', 10);