• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Programming / Skip Dashboard WordPress Plugin

Skip Dashboard WordPress Plugin

Last updated on April 27, 2016 by Sal Ferrarello

I find I spend very little time on the WordPress dashboard. Additionally, the Dashboard can be confusing for users when all you want to do is write a blog post. Thanks to the power of WordPress filters, we can send users directly to the backend Posts screen on log in and skip the dashboard.

We accomplish this with the login_redirect filter. By adding the following code snippet, we can redirect all logins to the backend Posts screen.

Example Redirect All Logins (Don’t Use this Code)

add_filter( 'login_redirect', 'fe_skip_dash' );

function fe_skip_dash( $url ) {
    return admin_url( 'edit.php' );
}

How to Redirect Logins to Backend Posts Screen

The problem with the code above is we’ll redirect all logins to the backend Posts screen but some users may not have access to view that page (e.g. by default Subscribers can not view the backend posts screen and will get an error message).

You do not have sufficient permissions to access this page.

We can solve this problem by checking the user can view the page before we redirect them.

add_filter( 'login_redirect', 'fe_skip_dash', 10, 3 );

function fe_skip_dash( $url, $request, $user ) {

    if ( ! $user ||  is_wp_error( $user ) ) {
        // There is no user.
        // Do not change the URL.
        return $url;
    }

    if ( ! user_can( $user, 'edit_posts' ) ) {
        // User can not view backend Posts screen.
        // Do not change the URL.
        return $url;
    }

    // Change the URL.
    return admin_url( 'edit.php' );
}

WordPress Skip Dashboard Plugin

I’ve combined this code into a WordPress plugin available on GitHub, WordPress Skip Dashboard Plugin.

Photo By

Never Give Up

Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit

Filed Under: Programming Tagged With: WordPress, WordPress Filter

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in