WordPress.org

Make WordPress Core

Ticket #20101: 20101.diff

File 20101.diff, 999 bytes (added by scribu, 2 years ago)
  • wp-includes/admin-bar.php

    diff --git wp-includes/admin-bar.php wp-includes/admin-bar.php
    index 41800c5..fb827d7 100644
     
    88/** 
    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 * 
     13 * For that, use show_admin_bar(false) or the 'show_admin_bar' filter. 
    1314 * 
    1415 * @since 3.1.0 
    1516 * @access private 
    function _wp_admin_bar_init() { 
    3637 
    3738        return true; 
    3839} 
    39 add_action( 'init', '_wp_admin_bar_init' ); // Don't remove. Wrong way to disable. 
     40add_action( 'admin_init', '_wp_admin_bar_init' ); 
     41add_action( 'template_redirect', '_wp_admin_bar_init', 0 ); 
    4042 
    4143/** 
    4244 * Render the admin bar to the page based on the $wp_admin_bar->menu member var.