[wp-trac] [WordPress Trac] #16856: When registering custom post type, menu_position isn't honored if it's a number passed as a string

WordPress Trac noreply at wordpress.org
Tue Jan 31 03:07:00 UTC 2017


#16856: When registering custom post type, menu_position isn't honored if it's a
number passed as a string
-------------------------------------------------+-------------------------
 Reporter:  nathanrice                           |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Plugins                              |  Release
 Severity:  normal                               |     Version:  3.1
 Keywords:  has-patch needs-testing needs-       |  Resolution:
  refresh dev-feedback                           |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------

Comment (by smerriman):

 Opened 6 years old but I'd like to add my voice to this one too. Recently
 in https://core.trac.wordpress.org/ticket/23316, it was permitted to add
 multiple menu items to the same menu_position without causing issues. This
 meant the previous workaround of needing to use decimals was no longer
 required.

 However, this doesn't apply to custom post types. Decimals are not
 permitted, and if I attempt to use the same menu_position for every one,
 the position gets incremented at each step.

 This means it is impossible for me to register 5 custom post types and
 place them between Pages and Comments in the admin menu. When I assign a
 menu position of 20 to each, all of the increments bump the 5th one to
 position 26, which appears after comments.

 Perhaps the same solution could be applied of small decimal increments,
 but at the least the fix above for allowing decimals would be a handy
 workaround.

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


More information about the wp-trac mailing list