From fb32b677e2aa10725cc588d9f8f3a06d8a4d558d Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 10 Nov 2011 00:42:39 +0000 Subject: [PATCH] Promote secondary admin bar items to primary if there are no primary items at time of render. see #19136, #19221. git-svn-id: https://develop.svn.wordpress.org/trunk@19236 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/class-wp-admin-bar.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index 4de3c27257..baa6455b30 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/wp-includes/class-wp-admin-bar.php @@ -159,7 +159,12 @@ class WP_Admin_Bar { } function recursive_render( $node ) { - $is_parent = ! empty( $node->children->primary ); + if ( ! $node->children->primary && $node->children->secondary ) { + $node->children->primary = $node->children->secondary; + $node->children->secondary = array(); + } + + $is_parent = (bool) $node->children->primary; $menuclass = $is_parent ? 'menupop' : ''; if ( ! empty( $node->meta['class'] ) )