apply_filters( 'pre_get_blogs_of_user', null|object[] $sites, int $user_id, bool $all )
- Since
- 4.6.0
Filters the list of a user's sites before it is populated.
Description
Returning a non-null value from the filter will effectively short circuit get_blogs_of_user(), returning that value instead.
Compatibility
- WordPress
- since 4.6.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$sitesnull|object[]- An array of site objects of which the user is a member.
$user_idint- User ID.
$allbool- Whether the returned array should contain all sites, including those marked 'deleted', 'archived', or 'spam'. Default false.
Where this hook fires · 1
wp-includes/user.php:1057get_blogs_of_user()
Source code
* * @param null|object[] $sites An array of site objects of which the user is a member. * @param int $user_id User ID. * @param bool $all Whether the returned array should contain all sites, including * those marked 'deleted', 'archived', or 'spam'. Default false. */ $sites = apply_filters( 'pre_get_blogs_of_user', null, $user_id, $all ); if ( null !== $sites ) { return $sites; } $keys = get_user_meta( $user_id );Changelog
Introduced in 4.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.