Make WordPress Core

Changeset 23512


Ignore:
Timestamp:
02/28/2013 04:56:35 PM (12 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/admin-bar.php

    r23360 r23512  
    99 * Instantiate the admin bar object and set it up as a global for access elsewhere.
    1010 *
    11  * To hide the admin bar, you're looking in the wrong place. Unhooking this function will not
    12  * properly remove the admin bar. For that, use show_admin_bar(false) or the show_admin_bar filter.
     11 * UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
     12 * For that, use show_admin_bar(false) or the 'show_admin_bar' filter.
    1313 *
    1414 * @since 3.1.0
     
    3737    return true;
    3838}
    39 add_action( 'init', '_wp_admin_bar_init' ); // Don't remove. Wrong way to disable.
     39// Don't remove. Wrong way to disable.
     40add_action( 'template_redirect', '_wp_admin_bar_init', 0 );
     41add_action( 'admin_init', '_wp_admin_bar_init' );
    4042
    4143/**
Note: See TracChangeset for help on using the changeset viewer.