_wp_admin_bar_init

The timeline below displays how wordpress function _wp_admin_bar_init has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.9

/**
 * Toolbar API: Top-level Toolbar functionality
 *
 * @package WordPress
 * @subpackage Toolbar
 * @since 3.1.0
 */
/**
 * Instantiates the admin bar object and set it up as a global for access elsewhere.
 *
 * UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
 * For that, use show_admin_bar(false) or the {@see 'show_admin_bar'} filter.
 *
 * @since 3.1.0
 * @access private
 *
 * @global WP_Admin_Bar $wp_admin_bar
 *
 * @return bool Whether the admin bar was successfully initialized.
 */
function _wp_admin_bar_init()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing()) {
        return false;
    }
    /* Load the admin bar class code ready for instantiation */
    require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
    /* Instantiate the admin bar */
    /**
     * Filters the admin bar class to instantiate.
     *
     * @since 3.1.0
     *
     * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
     */
    $admin_bar_class = apply_filters('wp_admin_bar_class', 'WP_Admin_Bar');
    if (class_exists($admin_bar_class)) {
        $wp_admin_bar = new $admin_bar_class();
    } else {
        return false;
    }
    $wp_admin_bar->initialize();
    $wp_admin_bar->add_menus();
    return true;
}

WordPress Version: 4.6

/**
 * Toolbar API: Top-level Toolbar functionality
 *
 * @package WordPress
 * @subpackage Toolbar
 * @since 3.1.0
 */
/**
 * Instantiate the admin bar object and set it up as a global for access elsewhere.
 *
 * UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
 * For that, use show_admin_bar(false) or the {@see 'show_admin_bar'} filter.
 *
 * @since 3.1.0
 * @access private
 *
 * @global WP_Admin_Bar $wp_admin_bar
 *
 * @return bool Whether the admin bar was successfully initialized.
 */
function _wp_admin_bar_init()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing()) {
        return false;
    }
    /* Load the admin bar class code ready for instantiation */
    require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
    /* Instantiate the admin bar */
    /**
     * Filters the admin bar class to instantiate.
     *
     * @since 3.1.0
     *
     * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
     */
    $admin_bar_class = apply_filters('wp_admin_bar_class', 'WP_Admin_Bar');
    if (class_exists($admin_bar_class)) {
        $wp_admin_bar = new $admin_bar_class();
    } else {
        return false;
    }
    $wp_admin_bar->initialize();
    $wp_admin_bar->add_menus();
    return true;
}

WordPress Version: 4.4

/**
 * Toolbar API: Top-level Toolbar functionality
 *
 * @package WordPress
 * @subpackage Toolbar
 * @since 3.1.0
 */
/**
 * Instantiate the admin bar object and set it up as a global for access elsewhere.
 *
 * 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
 *
 * @global WP_Admin_Bar $wp_admin_bar
 *
 * @return bool Whether the admin bar was successfully initialized.
 */
function _wp_admin_bar_init()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing()) {
        return false;
    }
    /* Load the admin bar class code ready for instantiation */
    require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
    /* Instantiate the admin bar */
    /**
     * Filter the admin bar class to instantiate.
     *
     * @since 3.1.0
     *
     * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
     */
    $admin_bar_class = apply_filters('wp_admin_bar_class', 'WP_Admin_Bar');
    if (class_exists($admin_bar_class)) {
        $wp_admin_bar = new $admin_bar_class();
    } else {
        return false;
    }
    $wp_admin_bar->initialize();
    $wp_admin_bar->add_menus();
    return true;
}

WordPress Version: 4.3

/**
 * Admin Bar
 *
 * This code handles the building and rendering of the press bar.
 */
/**
 * Instantiate the admin bar object and set it up as a global for access elsewhere.
 *
 * 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
 *
 * @global WP_Admin_Bar $wp_admin_bar
 *
 * @return bool Whether the admin bar was successfully initialized.
 */
function _wp_admin_bar_init()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing()) {
        return false;
    }
    /* Load the admin bar class code ready for instantiation */
    require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
    /* Instantiate the admin bar */
    /**
     * Filter the admin bar class to instantiate.
     *
     * @since 3.1.0
     *
     * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
     */
    $admin_bar_class = apply_filters('wp_admin_bar_class', 'WP_Admin_Bar');
    if (class_exists($admin_bar_class)) {
        $wp_admin_bar = new $admin_bar_class();
    } else {
        return false;
    }
    $wp_admin_bar->initialize();
    $wp_admin_bar->add_menus();
    return true;
}

WordPress Version: 4.2

/**
 * Admin Bar
 *
 * This code handles the building and rendering of the press bar.
 */
/**
 * Instantiate the admin bar object and set it up as a global for access elsewhere.
 *
 * 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
 * @return bool Whether the admin bar was successfully initialized.
 */
function _wp_admin_bar_init()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing()) {
        return false;
    }
    /* Load the admin bar class code ready for instantiation */
    require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
    /* Instantiate the admin bar */
    /**
     * Filter the admin bar class to instantiate.
     *
     * @since 3.1.0
     *
     * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
     */
    $admin_bar_class = apply_filters('wp_admin_bar_class', 'WP_Admin_Bar');
    if (class_exists($admin_bar_class)) {
        $wp_admin_bar = new $admin_bar_class();
    } else {
        return false;
    }
    $wp_admin_bar->initialize();
    $wp_admin_bar->add_menus();
    return true;
}

WordPress Version: 3.8

/**
 * Admin Bar
 *
 * This code handles the building and rendering of the press bar.
 */
/**
 * Instantiate the admin bar object and set it up as a global for access elsewhere.
 *
 * 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
 * @return bool Whether the admin bar was successfully initialized.
 */
function _wp_admin_bar_init()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing()) {
        return false;
    }
    /* Load the admin bar class code ready for instantiation */
    require ABSPATH . WPINC . '/class-wp-admin-bar.php';
    /* Instantiate the admin bar */
    /**
     * Filter the admin bar class to instantiate.
     *
     * @since 3.1.0
     *
     * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
     */
    $admin_bar_class = apply_filters('wp_admin_bar_class', 'WP_Admin_Bar');
    if (class_exists($admin_bar_class)) {
        $wp_admin_bar = new $admin_bar_class();
    } else {
        return false;
    }
    $wp_admin_bar->initialize();
    $wp_admin_bar->add_menus();
    return true;
}

WordPress Version: 3.7

/**
 * Admin Bar
 *
 * This code handles the building and rendering of the press bar.
 */
/**
 * Instantiate the admin bar object and set it up as a global for access elsewhere.
 *
 * 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
 * @return bool Whether the admin bar was successfully initialized.
 */
function _wp_admin_bar_init()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing()) {
        return false;
    }
    /* Load the admin bar class code ready for instantiation */
    require ABSPATH . WPINC . '/class-wp-admin-bar.php';
    /* Instantiate the admin bar */
    $admin_bar_class = apply_filters('wp_admin_bar_class', 'WP_Admin_Bar');
    if (class_exists($admin_bar_class)) {
        $wp_admin_bar = new $admin_bar_class();
    } else {
        return false;
    }
    $wp_admin_bar->initialize();
    $wp_admin_bar->add_menus();
    return true;
}