Function: get_active_blog_for_user

get_active_blog_for_user( integer $user_id )

Get one of a user's active blogs

Returns the user's primary blog, if they have one and it is active. If it's inactive, function returns another active blog of the user. If none are found, the user is added as a Subscriber to the Dashboard Blog and that blog is returned.


Name Type(s) Default Value Description
$user_id integer

The unique ID of the user


WP_Site | void

The blog object

WordPress Developer Newsletter

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