[wp-trac] [WordPress Trac] #40927: Passing a float as the position in add_menu_page can override other menu items
WordPress Trac
noreply at wordpress.org
Thu Apr 7 01:52:30 UTC 2022
#40927: Passing a float as the position in add_menu_page can override other menu
items
-------------------------------------------------+-------------------------
Reporter: justinbusa | Owner:
| SergeyBiryukov
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 6.0
Component: Administration | Version: 4.8
Severity: normal | Resolution:
Keywords: has-patch dev-feedback needs- | Focuses:
testing has-unit-tests | administration
-------------------------------------------------+-------------------------
Comment (by peterwilsoncc):
@costdev @SergeyBiryukov @audrasjb I've created a much simpler
[https://github.com/WordPress/wordpress-develop/pull/2479 pull request
#2479] to allow for the numerous plugins passing the position as a float.
* I've removed the new `_doing_it_wrong` so it can be dealt with
later/discussed
* `null` or a non-numeric string append new menu to final position
* reordered collision detection, made it a little faster with an order of
operations change
* tests are passing, which is nice
Additionally, in the commit [https://github.com/WordPress/wordpress-
develop/pull/2479/commits/ceebb6a8c40236316c0fe845d15f92ff23a3c9c2
ceebb6a8c] I've modified the code for `add_submenu_page` to be consistent
with the add_menu_page changes on this ticket.
* allows floats or ints
* reduces cases in which the doing it wrong added in [46570] for #48249
can fire
* retains the completely different method submenus use for determining the
position
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40927#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list