Old Post Road
Old Post Road

Reputation: 1

Is there a way to hide menu items from specific admin ID's in Wordpress

I have 3 admin accounts: one admin for me (shows everything) and 2 others where they need admin access to most items.

I was able to hide the main menu items (posts, pages, comments, appearance, etc) in the functions, however what about hiding menu items that are created from a plugin or other ones that are not part of the Wordpress central menu item list?

For example, Contact Form 7 Database creates 'Contact Forms' on the side bar menu or Google Google Site Kit creates 'Site Kit', and I have others where id like to hide them based on the username or user ID.

anyone know how to do that?

Upvotes: 0

Views: 538

Answers (1)

Zirekx
Zirekx

Reputation: 85

You can use such a Jewish method, which of course it does not promote, but it is effective: There is function in wordpress get_role( string $role ). You can just one of two methods:

  1. For lazy people. Just call function in functions.php that generate some css with display:none for individual users.
  2. Second, is similar. Just find where plugin or theme generates these items and use function mentioned above to render them for individual roles. I recommend using String Locator plugin to find code in site.

Upvotes: 0

Related Questions