2

When you login to the admin you see the Welcome page by default. A client of mine requested to see the "Pages" page by default, he had seen it somewhere else.

Is this possible, and if so, how? Tried searching but found nothing relevant, didn't find it in the settings either.

3

This should work for you if you put it in your themes functions.php file, but you may want to modify the conditions, and the url to redirect to depending on your set up.

function loginRedirect( $redirect_to, $request, $user ){
    if( is_array( $user->roles ) ) { // check if user has a role
        return "/wp-admin/edit.php?post_type=page";
    }
}
add_filter("login_redirect", "loginRedirect", 10, 3);

Here's a link containing more info about using the login_redirect filter: http://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect

There's also a few login redirect plugins floating around if you do a google search.

  • What's the $request for? I don't see where it's used. I removed it and it seems to work, thanks! – qwerty Oct 24 '12 at 7:14
  • 1
    You probably don't really need it, but it is for checking the url that the user is coming from. – Ben HartLenn Oct 24 '12 at 17:01
  • You need to add ! is_wp_error() to your test... at least in WordPress 5+ if( ! is_wp_error( $user) && is_array( $user->roles ) ) { – Lance Cleveland Feb 27 at 16:27
0

Great answer from Ben

to improve on it add home_url() to allow this to work on localhost or server.

if( is_array( $user->roles ) ) {
    return home_url() . "/wp-admin/edit.php?post_type=page";
}
  • Hi, thanks for your contribution. To make the site format work well try to make your answer complete. In this case, offering an improvement to an existing answer, you could make an edit when you have enough reputation or possibly make it as a comment on the answer you refer to. – Andy Macaulay-Brook Jun 23 '18 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.