get_blogs_of_user
Filters the list of sites a user belongs to.
Usage
add_filter( 'get_blogs_of_user', 'wp_kama_get_blogs_of_user_filter', 10, 3 ); /** * Function for `get_blogs_of_user` filter-hook. * * @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'. * * @return object[] */ function wp_kama_get_blogs_of_user_filter( $sites, $user_id, $all ){ // filter... return $sites; }
- $sites(object[])
- An array of site objects belonging to the user.
- $user_id(int)
- User ID.
- $all(true|false)
- Whether the returned sites array should contain all sites, including those marked 'deleted', 'archived', or 'spam'.
Default: false
Changelog
Since 3.0.0 | Introduced. |
Where the hook is called
get_blogs_of_user
wp-includes/user.php 1063
return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all );