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:
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.
-
Comfortable Admin Page70+ installs
do_action( 'admin_bar_init' )includes/bar-hide.php:70 -
Multisite Admin Bar Switcher10+ installs
do_action( 'admin_bar_init' )mabs_admin_bar.php:61 -
YOOAdmin10+ installs
do_action( 'admin_bar_init' )includes/helpers/shell-user-menu.php:302 -
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.