钩子文档

added_existing_user

💡 云策文档标注

概述

added_existing_user 是一个 WordPress Hook,在现有用户被添加到站点后立即触发。它主要用于多站点环境,允许开发者执行自定义操作。

关键要点

  • 触发时机:在现有用户被添加到站点后立即执行。
  • 参数:$user_id(用户 ID)和 $result(成功时为 true,失败时为 WP_Error 对象)。
  • 相关函数:与 add_existing_user_to_blog() 函数关联,用于基于 maybe_add_existing_user_to_blog() 的细节添加用户。
  • 版本历史:自 WordPress MU 3.0.0 版本引入。

📄 原文内容

Fires immediately after an existing user is added to a site.

Parameters

$user_idint
User ID.
$resulttrue|WP_Error
True on success or a WP_Error object if the user doesn’t exist or could not be added.

Source

do_action( 'added_existing_user', $details['user_id'], $result );

Changelog

Version Description
MU (3.0.0) Introduced.