WordPress at a glance
function is not described

_wp_admin_bar_init() WP 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.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

Hooks from the function

true|false. Whether the admin bar was successfully initialized.




  • Global. WP_Admin_Bar. $wp_admin_bar


Since 3.1.0 Introduced.

Code of _wp_admin_bar_init() WP 5.7.2

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;


	return true;