How To Stop Users From Accessing WordPress Dashboard?

You can easily disable all your website users (excluding the site administrators) from accessing your admin area dashboard. WP User Redirects is the new WordPress plugin which not only disables you website users from accessing the admin area dashboard but it also hides the admin toolbar and if a person tries entering the admin section by suffixing /wp-admin, the plugin automatically directs his to the home page.

WP User Redirects is a great plugin if you are designing a website with all frontend features or creating a social network with BuddyPress.

All you need to so is install and activate this plugin and that is all. There are no configuration options to set, upon activation the plugin automatically hides the admin section and the admin toolbar for all users, excluding the website administrators.

Alternative Method:

Alternatively, you can use  WP User Redirects code (by Joel James) in your theme’s function.php file.

function js_admin_redirect(){
    if( !current_user_can(‘activate_plugins’) ){
        wp_redirect( get_bloginfo(‘wpurl’) );
        exit;
    }
}
add_action(‘admin_init’,’js_admin_redirect’);

function js_admin_hide(){
    if( !current_user_can(‘activate_plugins’) ){
        show_admin_bar( false );
        exit;
    }
}
add_action(‘admin_init’,’js_admin_hide’);
add_filter(‘show_admin_bar’, ‘__return_false’);

Just copy-paste the given code in your theme theme functions file and it works the same.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.