How to Limit WordPress Dashboard Access

From the WordPress admin dashboard, you can easily control everything on your website. Your dashboard is the key to all your website access. You can select the users to who you want to give those access. You can limit the access of your users from the WordPress admin dashboard.

There are a lot of reasons you need to limit user access. If you run a multi-author or a subscription base website then you need to limit the functionality of others users. You can also block your subscriber to view your dashboard.

Whatever your reason is, here in this article we will show you how you can easily limit WordPress Dashboard Access.

Limit WordPress Dashboard Access

Limit dashboard access with user roles and permission

From WordPress user roles you can select who can see what part of your website. With different roles, users can have different access and ability to do in your site. The owner can select the roles so that everyone can only access their assigned part. Users with access to writing posts and comments don’t have the capability to change any theme settings. WordPress has many different user roles. They are –

  • Subscriber: It has only limited capability. The user can only access their profile.
  • Contributor: This user role can write the post on your website but they don’t have the power o publish it.
  • Author: They can manage and publish their post on your website
  • Editor: Editors can publish and manage posts as well as they can publish other user’s posts.
  • Admin/Super admin:  Has access to website administration features. Super admin is available with the multi-site.

Each role has each capability. So you can manage your users easily by giving them their user role. You can change the role from Users > All Users from the dashboard.

Limit dashboard access with code

This little code will block non-administrators users to access the website’s back-end. This will allow having access with only admins and others users will be redirected to the home page. This snippet will only work when a user logs into the WordPress dashboard. It won’t apply to any user that’s not non-logged, because they wouldn’t have any dashboard access, to begin with. You need to put this code into your child theme’s function.php file

add_action( ‘init’, ‘blockusers_init’ );
function blockusers_init() {
if ( is_admin() && ! current_user_can( ‘administrator’ ) &&
! ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
wp_redirect( home_url() );

By using this method you can ensure users what they need to complete their task on your website. This is not limited to just the Contributor role, of course, so the same can be applied to other user roles and capabilities depending on your needs.

Wrapping Up

We hope this article will help you. You can also see our other articles to learn How to Add a Request to the Callback Form in WordPress

How to Create Custom Taxonomies in WordPress

If you like this article please like our Facebook Page to stay connected.

You Might Also Like