From 99aa8742704942eba1622e749e97f69a8fc4acc6 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Fri, 17 Dec 2010 08:34:36 +0000 Subject: [PATCH] Ensure show_admin_bar( false ) works after init. Fixes #15856. git-svn-id: https://develop.svn.wordpress.org/trunk@17021 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 97dbd4ee5c..3a2bd460a0 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -4484,6 +4484,11 @@ function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = ar function show_admin_bar( $show ) { global $show_admin_bar; $show_admin_bar = (bool) $show; + + // Remove the object if we are not going to be showing + // Otherwise you have to call this function prior to the init hook for it to work! + if ( ! $show_admin_bar && isset( $GLOBALS['wp_admin_bar'] ) ) + $GLOBALS['wp_admin_bar'] = null; } ?> \ No newline at end of file