函数文档

wp_get_password_hint()

💡 云策文档标注

概述

wp_get_password_hint() 函数用于获取建议创建强密码的文本提示,返回一个字符串。该函数包含一个可过滤的 Hook,允许开发者自定义密码复杂度策略的描述。

关键要点

  • 函数返回一个字符串,包含密码长度和字符类型的建议提示。
  • 通过 apply_filters('password_hint', $hint) 提供 Hook,允许使用 password_hint 过滤器自定义提示文本。
  • 函数自 WordPress 4.1.0 版本引入,相关函数包括 __() 和 apply_filters()。

📄 原文内容

Gets the text suggesting how to create strong passwords.

Return

string The password hint text.

Source

function wp_get_password_hint() {
	$hint = __( 'Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).' );

	/**
	 * Filters the text describing the site's password complexity policy.
	 *
	 * @since 4.1.0
	 *
	 * @param string $hint The password hint text.
	 */
	return apply_filters( 'password_hint', $hint );
}

Hooks

apply_filters( ‘password_hint’, string $hint )

Filters the text describing the site’s password complexity policy.

Changelog

Version Description
4.1.0 Introduced.