WordPress action hook · part of WordPress core

admin_bar_init

A WordPress core action that 4 plugins also fire themselves, running on 90+ sites between them.

“Fires after WP_Admin_Bar is initialized.”

How to use admin_bar_init

It's an action: your callback runs at that point. Nothing needs to be returned. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_action( 'admin_bar_init', function() {
	// Your code runs here.
}, 10, 1 );

Argument names come from Comfortable Admin Page's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

4 plugins that fire admin_bar_init

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Comfortable Admin Page icon Comfortable Admin Page70+ installs do_action( 'admin_bar_init' ) includes/bar-hide.php:70
  2. Multisite Admin Bar Switcher icon Multisite Admin Bar Switcher10+ installs do_action( 'admin_bar_init' ) mabs_admin_bar.php:61
  3. YOOAdmin icon YOOAdmin10+ installs do_action( 'admin_bar_init' ) includes/helpers/shell-user-menu.php:302
  4. GrowthHive Easy Toolbar Visibility icon GrowthHive Easy Toolbar VisibilityFewer than 10 installs do_action( 'admin_bar_init' ) includes/menu.php:406

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.