Filter hook 'wp_admin_bar_show_site_icons'

in WP Core File wp-includes/admin-bar.php at line 682

View Source

wp_admin_bar_show_site_icons

Filter Hook
Description
Filters whether to show the site icons in toolbar. Returning false to this hook is the recommended way to hide site icons in the toolbar. A truthy return may have negative performance impact on large multisites.

Hook Information

File Location wp-includes/admin-bar.php View on GitHub
Hook Type Filter
Line Number 682

Hook Parameters

Type Name Description
bool $show_site_icons Whether site icons should be shown in the toolbar. Default true.

Usage Examples

Basic Usage
<?php
// Hook into wp_admin_bar_show_site_icons
add_filter('wp_admin_bar_show_site_icons', 'my_custom_filter', 10, 1);

function my_custom_filter($show_site_icons) {
    // Your custom filtering logic here
    return $show_site_icons;
}

Source Code Context

wp-includes/admin-bar.php:682 - How this hook is used in WordPress core
<?php
 677  	 *
 678  	 * @since 6.0.0
 679  	 *
 680  	 * @param bool $show_site_icons Whether site icons should be shown in the toolbar. Default true.
 681  	 */
 682  	$show_site_icons = apply_filters( 'wp_admin_bar_show_site_icons', true );
 683  
 684  	foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
 685  		switch_to_blog( $blog->userblog_id );
 686  
 687  		if ( true === $show_site_icons && has_site_icon() ) {

PHP Documentation

<?php
/**
	 * Filters whether to show the site icons in toolbar.
	 *
	 * Returning false to this hook is the recommended way to hide site icons in the toolbar.
	 * A truthy return may have negative performance impact on large multisites.
	 *
	 * @since 6.0.0
	 *
	 * @param bool $show_site_icons Whether site icons should be shown in the toolbar. Default true.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/admin-bar.php
Related Hooks

Related hooks will be displayed here in future updates.