the_password_form_incorrect_password
云策文档标注
概述
the_password_form_incorrect_password 是一个 WordPress 过滤器,用于自定义在密码保护文章中显示无效密码时的错误消息。此过滤器仅在文章受密码保护时应用。
关键要点
- 过滤器名称:the_password_form_incorrect_password
- 用途:过滤无效密码消息,允许开发者自定义错误提示文本
- 参数:$text(字符串,当前错误消息)和 $post(WP_Post 对象,相关文章)
- 应用场景:仅在密码保护文章中使用,如通过 get_the_password_form() 函数
- 引入版本:WordPress 6.8.0
代码示例
$invalid_password = apply_filters( 'the_password_form_incorrect_password', __( 'Invalid password.' ), $post );
原文内容
Filters the invalid password message shown on password-protected posts.
Description
The filter is only applied if the post is password-protected.
Parameters
$textstring-
The message shown to users when entering an invalid password.
$postWP_Post-
Post object.
Source
$invalid_password = apply_filters( 'the_password_form_incorrect_password', __( 'Invalid password.' ), $post );
Changelog
| Version | Description |
|---|---|
| 6.8.0 | Introduced. |