钩子文档

user_request_action_email_content

💡 云策文档标注

概述

user_request_action_email_content 是一个 WordPress 过滤器钩子,用于修改用户尝试账户操作时发送的电子邮件内容。它允许开发者自定义邮件文本,并支持动态替换特定占位符字符串。

关键要点

  • 过滤器钩子:user_request_action_email_content,用于过滤账户操作邮件的文本内容。
  • 参数:接受 $content(邮件文本)和 $email_data(邮件相关数据数组)两个参数。
  • 动态占位符:邮件内容中可使用 ###DESCRIPTION###、###CONFIRM_URL###、###SITENAME###、###SITEURL### 等占位符,系统会自动替换为实际值。
  • 相关函数:与 wp_send_user_request() 函数关联,用于发送确认请求邮件。
  • 引入版本:自 WordPress 4.9.6 版本起可用。

📄 原文内容

Filters the text of the email sent when an account action is attempted.

Description

The following strings have a special meaning and will get replaced dynamically:

  • ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
  • ###CONFIRM_URL### The link to click on to confirm the account action.
  • ###SITENAME### The name of the site.
  • ###SITEURL### The URL to the site.

Parameters

$contentstring
Text in the email.
$email_dataarray
Data relating to the account action email.

  • request WP_User_Request
    User request object.
  • email string
    The email address this is being sent to.
  • description string
    Description of the action being performed so the user knows what the email is for.
  • confirm_url string
    The link to click on to confirm the account action.
  • sitename string
    The site name sending the mail.
  • siteurl string
    The site URL sending the mail.

Source

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

Changelog

Version Description
4.9.6 Introduced.