Move admin bar initialization from init to template_redirect, so conditional tags may be used in the show_admin_bar filter. props scribu. fixes #20101.

git-svn-id: https://develop.svn.wordpress.org/trunk@23512 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-02-28 16:56:35 +00:00
parent 5114e85747
commit 34a00ae277

View File

@ -8,8 +8,8 @@
/**
* Instantiate the admin bar object and set it up as a global for access elsewhere.
*
* To hide the admin bar, you're looking in the wrong place. Unhooking this function will not
* properly remove the admin bar. For that, use show_admin_bar(false) or the show_admin_bar filter.
* UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
* For that, use show_admin_bar(false) or the 'show_admin_bar' filter.
*
* @since 3.1.0
* @access private
@ -36,7 +36,9 @@ function _wp_admin_bar_init() {
return true;
}
add_action( 'init', '_wp_admin_bar_init' ); // Don't remove. Wrong way to disable.
// Don't remove. Wrong way to disable.
add_action( 'template_redirect', '_wp_admin_bar_init', 0 );
add_action( 'admin_init', '_wp_admin_bar_init' );
/**
* Render the admin bar to the page based on the $wp_admin_bar->menu member var.