How to Hide Unnecessary Menu Items from Admin Menu in WordPress
- Article
- Comment (2)
How to Hide Unnecessary Menu Items from Admin Menu in WordPress. Sometimes we feel irritated with unused items in WordPress admin menu . So here I just thought to hide certain items from the admin menu, which i dont like to use all the time. From the admin menu items, I dont use the following items not properly.
- Media
- tools
- Appearance -> Editor
- Appearance ->Customize
- Plugins -> Editor.
That’s it, Probably you may use these above items and want to hide some other items from the menu. So, Here I gave you the code to hide it. Here you can hide Admin menut items using the following code. You can also remove the sub menu items too.
1. Menu Hide :
The “remove_menu_page” will help you to remove the main menu items like, themes.php, plugins.php, and etc. Here is an example for it.
add_action( 'admin_menu', 'kv_admin_link_hider' ); function kv_admin_link_hider() { remove_menu_page('plugins.php'); }
The above one will remove the plugins from the admin menu.
2. Submenu Hide
Here is the Submenu hider functions with examples,
add_action( 'admin_menu', 'kv_admin_link_hider' ); function kv_admin_link_hider() { remove_submenu_page('plugins.php', 'plugin-editor.php'); // admin plugin editor }
The above code will hide the Plugin Editor from the Admin menu. The same way you can remove any link from the admin. You can remove the link based on user roles. Here i am going to hide the plugin editor for the administrator Role. Here is the code to hide Editor for the Administrator.
if(current_user_can('mange_options')) { add_action( 'admin_menu', 'kv_admin_link_hider' ); function kv_admin_link_hider() { remove_submenu_page('plugins.php', 'plugin-editor.php'); } }
Likewise you can do many operations with “remove_submenu_page” function. Comment below your views and problems.
I have comments deactivated in adminimize in the menu options but it stil shows up on the admin screen for all users. I would like only admins and editors to see the comments.
add an action hook to restrict access to the comments page. thats possible with admin_init and an action hook