Plugin removes menu items with no submenu page
-
I have a plugin which adds a menu page with the
update_plugins
capability. There is another plugin I noticed which removes the plugin icon from the menu bar, but the plugin page can still be accessed directly via URL. Instead of the plugin icon, there is only a black void (see image).Workarounds:
1) When I change theupdate_plugins
capability in theadd_menu_page
method toactivate_plugins
, the problem is resolved.
2) If I were to have submenu pages for the plugin, the problem is resolved and the plugin icon is visible as it should be.To reproduce:
1) add menu page:$settings_page = \add_menu_page( 'Plugin Page Title', 'Menu title', 'update_plugins', 'menu_slug', array( $this, 'callback_fn' ), 'images/icon.png' );
2) Remove
update_plugins
option from bulk operations select list (from a separate plugin):global $current_user; $current_user->allcaps['update_plugins'] = 0;
I have using WP 5.8, PHP 8.0.8, non-multisite install (locally and on prod).
ScreenshotThe two conflicting plugins I am using are “Pre Party Browser Hints” (adds submenu page) and “Disable All WordPress Updates (removes
update_plugins
operation). I suspect this could be an issue with WP core code, because it does not seem like an intentional feature.
- The topic ‘Plugin removes menu items with no submenu page’ is closed to new replies.