Filter hook 'ms_user_list_site_class'

in WP Core File wp-admin/includes/class-wp-ms-users-list-table.php at line 398

View Source

ms_user_list_site_class

Filter Hook
Description
Filters the span class for a site listing on the multisite user list table.

Hook Information

File Location wp-admin/includes/class-wp-ms-users-list-table.php View on GitHub
Hook Type Filter
Line Number 398

Hook Parameters

Type Name Description
string[] $site_classes Array of class names used within the span tag. Default "site-#" with the site's network ID.
int $site_id Site ID.
int $network_id Network ID.
WP_User $user WP_User object.

Usage Examples

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

function my_custom_filter($site_classes, $site_id, $network_id, $user) {
    // Your custom filtering logic here
    return $site_classes;
}

Source Code Context

wp-admin/includes/class-wp-ms-users-list-table.php:398 - How this hook is used in WordPress core
<?php
 393  			 *                               Default "site-#" with the site's network ID.
 394  			 * @param int      $site_id      Site ID.
 395  			 * @param int      $network_id   Network ID.
 396  			 * @param WP_User  $user         WP_User object.
 397  			 */
 398  			$site_classes = apply_filters( 'ms_user_list_site_class', $site_classes, $site->userblog_id, $site->site_id, $user );
 399  
 400  			if ( is_array( $site_classes ) && ! empty( $site_classes ) ) {
 401  				$site_classes = array_map( 'sanitize_html_class', array_unique( $site_classes ) );
 402  				echo '<span class="' . esc_attr( implode( ' ', $site_classes ) ) . '">';
 403  			} else {

PHP Documentation

<?php
/**
			 * Filters the span class for a site listing on the multisite user list table.
			 *
			 * @since 5.2.0
			 *
			 * @param string[] $site_classes Array of class names used within the span tag.
			 *                               Default "site-#" with the site's network ID.
			 * @param int      $site_id      Site ID.
			 * @param int      $network_id   Network ID.
			 * @param WP_User  $user         WP_User object.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-admin/includes/class-wp-ms-users-list-table.php
Related Hooks

Related hooks will be displayed here in future updates.