Control Dashboard Access
Photo credit – declanjewell2472470758

For security reasons you may wish to disable dashboard access to subscribers and allow access to only Admins, Editors and Authors.

Below is a simple snippet of code to achieve this. Add below code in your theme’s functions.php file

The above code will redirect the user to your home page when the user tries to visit the Dashboard.

However in some cases you may want a certain subscriber to access Dashboard. In that case I have created a capability called as dashboard_access. This capability can be assigned to the required user.

Leave a Reply

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