[wp-trac] [WordPress Trac] #54073: Plugin removes menu items with no submenu page
WordPress Trac
noreply at wordpress.org
Fri Sep 3 17:36:27 UTC 2021
#54073: Plugin removes menu items with no submenu page
----------------------------+-----------------------------
Reporter: samperrow | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 5.8
Severity: minor | Keywords:
Focuses: |
----------------------------+-----------------------------
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 the update_plugins capability in the add_menu_page method
to activate_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:
{{{#!php
<?php
$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):
{{{#!php
<?php
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). I have noticed this happens for other matching capabilities too
(`activate_plugins`) for example.
Screenshot: [[Image(https://imgur.com/LlXaxPl)]]
The 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54073>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list