Help! Turn php link data into url OR hide edit link in post admin OR hide drafts for all users except admin?

As far as I understood this right, you want to disable the possibility to reach any other side aside from the dashboard.

Well, then here’s a short plugin for you:

<?php
! defined( 'ABSPATH' ) AND exit;
/* Plugin Name: (#45989) »kaiser« Allow Dashboard only access */

function wpse45989_access_dashboard_only()
{
    if (
        ! isset( get_current_screen()->id )
        OR 'dashboard' !== get_current_screen()->id
        )
    {
        // Lets limit this to only specific user roles
        if ( current_user_can( 'ROLE_NAME_HERE' ) )
            exit( wp_redirect( admin_url() ) );
    }
}
add_action( 'current_screen', 'wpse45989_access_dashboard_only', 100 );

Leave a Comment