Login Redirect Based on Role

Is there any way to redirect based on Role?

  • DavidM
    • DEV MAN’s Mascot

    Hi Atalanta,

    That would take some editing of the plugin code, but you might find it easier to just code up your own, something like the following:

    function redirect_by_role () {
    global $current_user, $wp_roles;
    if( current_user_can ( 'manage_options' ) ) {
    return 'http://yourdomain.com/wp-admin/';
    } else if ( current_user_can ( 'activate_plugins' ) ) {
    return 'http://yourdomain.com/account/';
    } else {
    return 'http://yourdomain.com/';
    add_filter('login_redirect', 'plugin_admin_redirect');

    Best way is always to add that via a basic plugin, but adding to functions.php should suffice too.

    That said, it sounds like it would be a cool idea to integrate in the plugin itself, perhaps you could post a request on this in the feature suggestion forum?


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.