Skip to content
Menu
Menu

How To Restrict Users To Access The WordPress Dashboard?

Generally, subscriber users are limited to access to the WordPress dashboard. However, they can still log in to the dashboard and revise their profile. Below is the screenshot showing what it looks like when the user accesses the WordPress dashboard.

Although the user can revise their profile if they are allowed to log in to the WordPress dashboard, it also causes some security risks to your website. Also, it looks unprofessional if the user can access your dashboard easily.

Cons of allowing the user to access the WordPress dashboard

Security Risks

Allowing user logins introduces potential security risks, especially if user accounts have weak passwords or if there is a vulnerability in the WordPress installation.

Increased Admin Workload

As the number of registered users increases, so does the potential workload for site administrators, including account management, support, and user-related issues.

Spam and Unwanted User Accounts

Open registration might attract spam registrations, leading to unwanted user accounts. Implementing additional security measures and anti-spam plugins is necessary.

If you are running a professional WordPress website, we recommend you restrict the user to access the WordPress dashboard.

How to restrict the user from accessing the WordPress dashboard?

Use WordPress Plugin

If you know nothing about coding, you can just use a WordPress plugin to restrict the user from accessing your WordPress Dashboard. The plugin is easy to install and fully meets your requirements to prevent users and subscribers from accessing the WordPress dashboard.

Adding a snippet code to functions.php

Edit your theme’s functions.php file (located in the theme folder) and add the following code at the end

// Disable dashboard access for subscribers
if (current_user_can('subscriber')) {
    add_action('admin_init', 'restrict_dashboard_access');
}

function restrict_dashboard_access() {
    wp_redirect(home_url());
    exit;
}

Leave a Reply