钩子文档

invited_user_email

💡 云策文档标注

概述

invited_user_email 是一个 WordPress 过滤器钩子,用于自定义现有用户被邀请加入站点时发送的电子邮件内容。它允许开发者修改邮件参数,如收件人地址、主题和正文。

关键要点

  • 这是一个过滤器钩子,用于处理用户邀请邮件的构建。
  • 参数包括 $new_user_email(用于构建 wp_mail() 的数组)、$user_id(被邀请用户的 ID)、$role(角色信息数组)和 $newuser_key(邀请密钥)。
  • 通过 apply_filters 调用,开发者可以修改邮件内容以定制化邀请体验。

代码示例

$new_user_email = apply_filters( 'invited_user_email', $new_user_email, $user_id, $role, $newuser_key );

📄 原文内容

Filters the contents of the email sent when an existing user is invited to join the site.

Parameters

$new_user_emailarray
Used to build wp_mail() .

  • to string
    The email address of the invited user.
  • subject string
    The subject of the email.
  • message string
    The content of the email.
  • headers string
    Headers.

$user_idint
The invited user’s ID.
$rolearray
Array containing role information for the invited user.
$newuser_keystring
The key of the invitation.

Source

$new_user_email = apply_filters( 'invited_user_email', $new_user_email, $user_id, $role, $newuser_key );

Changelog

Version Description
5.6.0 Introduced.