[wp-trac] [WordPress Trac] #54798: Check for int in menu priority

WordPress Trac noreply at wordpress.org
Tue Apr 26 03:42:24 UTC 2022

#54798: Check for int in menu priority
 Reporter:  kirtan95                  |       Owner:  audrasjb
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.0
Component:  Administration            |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
Changes (by peterwilsoncc):

 * status:  reopened => closed
 * resolution:   => fixed


 I think this can be closed with the commits on #40927

 `add_menu_page()` position:

 * can be either a float or an integer in line with common plugin practices
 * the default position, `null`, adds the menu as the last item
 * a `_doing_it_wrong()` notice is triggered if the position is not
 * `float` types are cast to `string` to ensure PHP doesn't internally cast
 the number to an integer
 * the position is sorted as a human would expect it, eg: `1, "1.043", "2",

Ticket URL: <https://core.trac.wordpress.org/ticket/54798#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list