WordPress – How to disable dashboard access to subscribers

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.

WordPress – Limit pages displayed in the parent page drop down

If you have lot of pages in your wordpress site then it becomes quite big problem selecting parent pages from a huge drop down.

There is a way to show only selected pages in the drop down as selectable parent pages.

This is never an issue for bloggers who have majority of their content in posts as there is no need to select parent post for a blog.

Download this plugin from WordPress plugin directory

Step 1: Create a custom field/Radio button to select if the page is to be listed in the drop down or not


Step 2: Save the option to the post custom field


Step 3: Limit pages listed in the page attributes drop down and quick edit parent page drown down


In Step 3 we are checking for pages which have custom field parent_dropdown set to 0 and excluding those pages from the page attributes drop down pages

WordPress how to assign only necessary capabilities to users

Quite often there is a requirement in wordpress to give certain users access to certain Administrative function e.g. manage widgets but you do not want to make them administrator for obvious reasons

Here are some steps to achieve this requirement

  1. Create some role e.g. widgets_manager (based on the Author role i.e. same as Author role)
  2. Assign edit_theme_options capability to this newly created role
  3. Now just add below code to your functions.php