[wp-trac] [WordPress Trac] #19371: As of 3.3beta2 WP_Admin_Bar no longer provides a way to access attributes of existing menu items
WordPress Trac
wp-trac at lists.automattic.com
Thu Dec 1 20:27:59 UTC 2011
#19371: As of 3.3beta2 WP_Admin_Bar no longer provides a way to access attributes
of existing menu items
------------------------------+---------------------
Reporter: willshouse | Owner: nacin
Type: defect (bug) | Status: closed
Priority: high | Milestone: 3.3
Component: Admin Bar | Version: 3.3
Severity: minor | Resolution: fixed
Keywords: has-patch commit |
------------------------------+---------------------
Comment (by willshouse):
I think we should possibly change "`get_nodes`" to be a public function.
If we don't change it to a public function, what is the proper method for
removing all child items from a node?
For example, if I wanted to remove all child items from the "`wp-logo`"
menu, I could do this:
{{{
remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
}}}
And then add back in the top level menu item:
{{{
$wp_admin_bar->add_menu( array(
'id' => 'wp-logo',
'title' => '<span class="ab-wp-logo"></span>',
'href' => admin_url( 'about.php' ),
) );
}}}
However that causes an error to be thrown:
{{{
Warning: Invalid argument supplied for foreach()
in class-wp-admin-bar.php on line 252
}}}
So can we either change "`get_nodes`" to a public function or can someone
let me know the best way to remove all child items (and child "groups") ?
ps: I think it would be OK if get_nodes was a public function. Since it is
just pulling data it won't affect the internal storage.
>>> This way, at least our internal storage is protected from plugins.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19371#comment:29>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list