[wp-trac] [WordPress Trac] #19541: wp_admin_bar_new_content_menu does not respect menu_position
WordPress Trac
wp-trac at lists.automattic.com
Wed Dec 14 02:26:54 UTC 2011
#19541: wp_admin_bar_new_content_menu does not respect menu_position
--------------------------+------------------------------
Reporter: davistobias | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Admin Bar | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------+------------------------------
Changes (by davistobias):
* keywords: => has-patch
Comment:
Function wp_admin_bar_new_content_menu (since 3.1.0) uses conditionals to
decide whether to show certain options, but these conditional array
elements disrupt the order specified by menu_position.
The function adds array elements for posts, media, links, and pages,
afterward adding the custom post types. The menu positions for the core
"create new" types is specified in the codex here:
[http://codex.wordpress.org/Function_Reference/register_post_type]
The difficulty of ordering the "create new" items is increased by the fact
that sorting an array on an integer key is not possible, since multiple
custom posts can choose the same menu position. Normal PHP sort methods
will remove duplicate keys, so an alternate approach was required.
The attached patch uses an additional array to hold the position keys, and
uses array_multisort() to order them.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19541#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list