Filter hook 'get_blogs_of_user'

in WP Core File wp-includes/user.php at line 1131

View Source

get_blogs_of_user

Filter Hook
Description
Filters the list of sites a user belongs to.

Hook Information

File Location wp-includes/user.php View on GitHub
Hook Type Filter
Line Number 1131

Hook Parameters

Type Name Description
object[] $sites An array of site objects belonging to the user.
int $user_id User ID.
bool $all Whether the returned sites array should contain all sites, including those marked 'deleted', 'archived', or 'spam'. Default false.

Usage Examples

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

function my_custom_filter($sites, $user_id, $all) {
    // Your custom filtering logic here
    return $sites;
}

Source Code Context

wp-includes/user.php:1131 - How this hook is used in WordPress core
<?php
1126  	 * @param object[] $sites   An array of site objects belonging to the user.
1127  	 * @param int      $user_id User ID.
1128  	 * @param bool     $all     Whether the returned sites array should contain all sites, including
1129  	 *                          those marked 'deleted', 'archived', or 'spam'. Default false.
1130  	 */
1131  	return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all );
1132  }
1133  
1134  /**
1135   * Finds out whether a user is a member of a given blog.
1136   *

PHP Documentation

<?php
/**
	 * Filters the list of sites a user belongs to.
	 *
	 * @since MU (3.0.0)
	 *
	 * @param object[] $sites   An array of site objects belonging to the user.
	 * @param int      $user_id User ID.
	 * @param bool     $all     Whether the returned sites array should contain all sites, including
	 *                          those marked 'deleted', 'archived', or 'spam'. Default false.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.