Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Hide a plugins submenu items. WordPress


Currently I use:

unset($submenu['themes.php'][5]); // Removes 'Themes'.

To remove submenu items from the admin area.

However, plugin's submenu items aren't in the $submenu array.

How can I remove submenu items that plugins add throughout your menu?

Answers (2)


Oleg Butuzov answers:

comment add_submenu_page function calls in plugins itself

or other add_*_menu functions (like add_management_page ro add_options_page)

Bill Johnson comments:

So your recommending editing the plugins files?

Oleg Butuzov comments:

well... you still can try to search for the submenus in menu filer but with a biger priority...

for example

add_filter('admin_menu', 'admin_menu_filter', 10000);

function admin_menu_filter(){
global $menu,$submenu;
//and take a look here... whats is inside of menu and submenu arrays...

Bill Johnson comments:

I was using add_action for some reason which resulted in the $submenu array without any of the plugin's menu items.

Changing add_action to add_filter with an low priority resulted in an array with the plugin's menu items.

Thanks a lot.



Kailey Lampert answers:

any chance they're in the $menu array?

Bill Johnson comments: