[wp-trac] [WordPress Trac] #44875: register_post_type won't accept menu_position as float (as string) like other admin menu functions do
WordPress Trac
noreply at wordpress.org
Thu Sep 6 13:24:51 UTC 2018
#44875: register_post_type won't accept menu_position as float (as string) like
other admin menu functions do
------------------------------------+------------------------------
Reporter: stiofansisland | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses: administration
------------------------------------+------------------------------
Changes (by earnjam):
* version: trunk => 3.0
Comment:
Adjusting version to 3.0. Looks like this `is_int()` check was added
originally back in [14014].
`add_menu_page()` suggests `menu_position` should be an int in the
documentation, but doesn't require that and actually seems like you could
pass a string for that value if you wanted to (though I haven't tested
that). It ends up doing a `uksort` by `strnatcasecmp` in
[https://github.com/WordPress/WordPress/blob/master/wp-
admin/includes/menu.php#L246 /wp-admin/includes/menu.php] to determine the
order.
If we're going to allow any string (or anything other than integers) to be
passed for `menu_position`, we should update the documentation for
`add_menu_page` and `register_post_type` to reflect that.
Also, @stiofansisland when creating patches, can you do it from the root
directory? It makes it easier to apply.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44875#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list