Wordpress: when entering the address list, not in the control panel

Is there a feature that allows you to change where you are redirected to after logging in?

I enter the standard login form in Wordpress, which redirects you to the control panel, is there any way to change it so that you are redirected to the list of pages?

It is important that I do not edit the main WP files (although this is easy, it requires trouble!) And does it with a function.

This is not any login to enter the system, all the backend simply redirects the standard login screen in WP from the control panel to the list of pages - wp-admin / edit.php? post_type = page (since I'm not like the information displayed on the dashboard).

+4
source share
1

functions.php:

function my_login_redirect( $redirect_to, $request, $user ){
    //is there a user to check?
    global $user;
    if( isset( $user->roles ) && is_array( $user->roles ) ) {
        //check for admins
        if( in_array( "administrator", $user->roles ) ) {
            // redirect them to the default place
            return home_url(); //admin redirect url
        } else {
            return admin_url( 'edit.php?post_type=page' ); //user redirect url
        }
    }
    else {
        return $redirect_to;
    }
}
add_filter("login_redirect", "my_login_redirect", 10, 3);

. ( , ), URL.

+5

All Articles