钩子文档

user_request_confirmed_email_content

💡 云策文档标注

概述

user_request_confirmed_email_content 是一个 WordPress 过滤器,用于修改用户请求确认邮件的正文内容。该邮件在用户请求被确认时发送给管理员,支持动态替换特定字符串以自定义邮件内容。

关键要点

  • 过滤器名称:user_request_confirmed_email_content
  • 用途:过滤用户请求确认邮件的正文,允许开发者自定义邮件内容
  • 动态字符串:支持替换 ###SITENAME###、###USER_EMAIL###、###DESCRIPTION###、###MANAGE_URL###、###SITEURL### 等占位符
  • 参数:$content(邮件内容字符串)和 $email_data(包含请求相关数据的数组)
  • 引入版本:WordPress 5.8.0

代码示例

$content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data );

注意事项

  • 邮件发送由 _wp_privacy_send_request_confirmation_notification() 函数触发,位于 wp-includes/user.php
  • $email_data 数组包含 request、user_email、description、manage_url、sitename、siteurl、admin_email 等键值,用于提供上下文信息

📄 原文内容

Filters the body of the user request confirmation email.

Description

The email is sent to an administrator when a user request is confirmed.
The following strings have a special meaning and will get replaced dynamically:

  • ###SITENAME### The name of the site.
  • ###USER_EMAIL### The user email for the request.
  • ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
  • ###MANAGE_URL### The URL to manage requests.
  • ###SITEURL### The URL to the site.

Parameters

$contentstring
The email content.
$email_dataarray
Data relating to the account action email.

  • request WP_User_Request
    User request object.
  • user_email string
    The email address confirming a request.
  • description string
    Description of the action being performed so the user knows what the email is for.
  • manage_url string
    The link to click manage privacy requests of this type.
  • sitename string
    The site name sending the mail.
  • siteurl string
    The site URL sending the mail.
  • admin_email string
    The administrator email receiving the mail.

Source

$content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data );

Changelog

Version Description
5.8.0 Introduced.