I have a function which adds an extra item (and sub-menu items) to the admin bar.
It shows a debug error of... Notice: WP_Admin_Bar::add_node was called incorrectly. The menu ID should not be empty.
function add_admin_bar_menu_misc() {
global $wp_admin_bar;
if ( !is_super_admin() || !is_admin_bar_showing() )
return;
$wp_admin_bar->add_menu( array(
'id' => 'misc',
'title' => 'Misc',
'href' => FALSE ) );
$wp_admin_bar->add_menu( array(
'parent' => 'misc',
'title' => 'Export',
'href' => admin_url('export.php'), ) );
$wp_admin_bar->add_menu( array(
'parent' => 'misc',
'title' => 'Back-up',
'href' => admin_url('admin.php?page=wp-dbmanager%2Fdatabase- backup.php'), ) );
}
add_action('admin_bar_menu', 'add_admin_bar_menu_misc', 999);
What do I need to do to fix it?
'id' => 'misc',
add id-s to other menu items also?