钩子文档

get_blogs_of_user

💡 云策文档标注

概述

get_blogs_of_user 是一个 WordPress 过滤器,用于修改用户所属站点的列表。它允许开发者在获取用户站点数据时进行自定义处理。

关键要点

  • 过滤器名称:get_blogs_of_user
  • 参数:$sites(站点对象数组)、$user_id(用户ID)、$all(布尔值,控制是否包含所有站点)
  • 用途:过滤或调整用户所属站点的返回结果
  • 相关函数:get_blogs_of_user()
  • 引入版本:MU (3.0.0)

📄 原文内容

Filters the list of sites a user belongs to.

Parameters

$sitesobject[]
An array of site objects belonging to the user.
$user_idint
User ID.
$allbool
Whether the returned sites array should contain all sites, including those flagged for deletion, archived, or marked as spam.

Source

return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all );

Changelog

Version Description
MU (3.0.0) Introduced.