Function: get_blogs_of_user

get_blogs_of_user( integer $user_id, boolean $all )

Get the sites a user belongs to.

Parameters

Name Type(s) Default Value Description
$user_id integer

User ID

$all boolean false

Whether to retrieve all sites, or only sites that are not marked as deleted, archived, or spam.

Returns

array

A list of the user's sites. An empty array if the user doesn't exist or belongs to no sites.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.