钩子文档

edit_user_created_user

💡 云策文档标注

概述

edit_user_created_user 是一个 WordPress 动作钩子,在创建新用户后触发,用于执行相关操作。

关键要点

  • 触发时机:新用户创建完成后立即执行
  • 参数:$user_id(用户ID或WP_Error对象)和$notify(通知类型)
  • 通知类型:支持 'admin'、'user'、'both' 或空字符串,默认值为 'both'
  • 相关函数:与 wp_send_new_user_notifications() 和 edit_user() 关联
  • 版本历史:自 WordPress 4.4.0 版本引入

代码示例

do_action( 'edit_user_created_user', $user_id, $notify );

📄 原文内容

Fires after a new user has been created.

Parameters

$user_idint|WP_Error
ID of the newly created user or WP_Error on failure.
$notifystring
Type of notification that should happen. See wp_send_new_user_notifications() for more information.

More Arguments from wp_send_new_user_notifications( … $notify )

Type of notification that should happen. Accepts 'admin' or an empty string (admin only), 'user', or 'both' (admin and user).
Default 'both'.

Source

do_action( 'edit_user_created_user', $user_id, $notify );

Changelog

Version Description
4.4.0 Introduced.