get_blogs_of_user
Filters the list of sites a user belongs to.
Использование
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'.
По умолчанию: false
Список изменений
С версии 3.0.0 | Введена. |
Где вызывается хук
get_blogs_of_user
wp-includes/user.php 1076
return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all );