WP Rocket - WordPress Caching Plugin

Hide WordPress admin menu from user/role [NO CODE]

Hide wordpress admin menu

Sometimes we need to hide some WordPress admin menu items from some users or some user roles.

We can easily do so with some coding skills but most site administrators need a way to hide those WordPress admin menu items without writing any PHP code.

In this article, we will use the Business rules WordPress plugin to hide WordPress admin menu items from specific users/roles without any coding skills, just mouse clicks.


Hide admin menu item from a specific user

  1. Create a new Business rule, from admin dashboard.
Add new business rule

2. Choose a title for this business rule (workflow)

3. Choose Admin Initialize trigger

4. At the conditions area, you need to click on Add New Condition

Add new condition

5. Select Current logged-in user condition

Current loggedin user condition

6. Choose the user you need to hide the menu item from.

Current loggedin user condition

7. At the actions area, click on Add New Action

Add new action

8. Choose Remove menu page from the actions list

Remove menu page action

9. Fill the field of the page as follows:

Menu page to remove: the part of the admin page URL after the main admin URL

For example, for the media page, the full URL is: http://localhost/wp-admin/upload.php

This textbox should have the value of: upload.php

10. Publish the rule and test it by logging in with the selected user to check if you can see the media menu item.

media menu removed

Hide admin menu item from a specific role

  1. Create a new Business rule, from admin dashboard.
Add new business rule

2. Choose a title for this business rule (workflow)

3. Choose Admin Initialize trigger

4. At the conditions area, you need to click on Add New Condition

Add new condition

5. Select Current logged-in user role condition

current loggedin user role

6. Choose the role you need to hide the menu item from.

current loggedin user role condition

7. At the actions area, click on Add New Action

Add new action

8. Choose Remove menu page from the actions list

Remove menu page action

9. Fill the field of the page as follows:

Menu page to remove: the part of the admin page URL after the main admin URL

For example, for the media page, the full URL is: http://localhost/wp-admin/upload.php

This textbox should have the value of: upload.php

10. Publish the rule and test it by logging in with the selected role to check if you can see the media menu item.

media menu removed

Summary

In this tutorial, we learned how to show an admin notice to one user role and to a specific user using the Business rules (Workflow) WordPress plugin.

Leave a Reply

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