[wp-trac] [WordPress Trac] #54026: One admin menu item from different plugins

WordPress Trac noreply at wordpress.org
Fri Aug 27 15:12:02 UTC 2021


#54026: One admin menu item from different plugins
----------------------------+------------------------------
 Reporter:  kimjo           |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  close           |     Focuses:  administration
----------------------------+------------------------------

Comment (by kimjo):

 Replying to [comment:1 SergeyBiryukov]:
 > Hi there, welcome to WordPress Trac! Thanks for the report.
 >
 > > Is there a way to avoid that behaviour ?
 >
 > Just removing one of the two `add_menu_page()` calls (doesn't matter
 which one) should give you one menu item with two submenus. If that is not
 feasible for whatever reason, calling `remove_menu_page( 'test-plugin-
 admin' )` after both plugins are loaded should remove the first menu item
 and keep the second one.

 Thanks for the reply, but that will not work:

 I run several plugins and i do not know, which of those are
 enabled/activated. So each plugin has to create the admin menu item to
 link the own submenus to it. I have looked around for a function to search
 for already existing menuitems, but had no success.

 I think, that WP (working as a "framework" in this case) should detect and
 solve this problem automatically.


 > I have just tested both options, and they appear to work. I'm marking
 the ticket as a `close` candidate, as it looks like WordPress core works
 as expected here.

 Sorry, but i think this is not the way, WP should handle those effects.

 WP should merge those menu items (in the admin backend) automatically.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54026#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list