钩子文档

login_headertitle

💡 云策文档标注

概述

login_headertitle 是一个已弃用的 WordPress 过滤器,用于修改登录页面头部徽标的 title 属性。自 WordPress 5.2.0 起,建议使用 login_headertext 替代,以提升可访问性。

关键要点

  • 这是一个过滤器,用于自定义登录表单上方徽标的 title 属性。
  • 自 WordPress 5.2.0 起被弃用,推荐使用 login_headertext 过滤器。
  • 弃用原因:出于可访问性考虑,不建议在登录徽标上使用 title 属性,应改用链接文本。
  • 相关函数:login_header() 用于输出登录页面头部。

代码示例

$login_header_title = apply_filters_deprecated(
    'login_headertitle',
    array( $login_header_title ),
    '5.2.0',
    'login_headertext',
    __( 'Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead.' )
);

注意事项

  • 在开发新插件或主题时,应避免使用此过滤器,转而使用 login_headertext。
  • 如果维护旧代码,需检查 WordPress 版本兼容性,例如使用 version_compare 函数。

📄 原文内容

Filters the title attribute of the header logo above login form.

Parameters

$login_header_titlestring
Login header logo title attribute.

Source

$login_header_title = apply_filters_deprecated(
	'login_headertitle',
	array( $login_header_title ),
	'5.2.0',
	'login_headertext',
	__( 'Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead.' )
);

Changelog

Version Description
5.2.0 Deprecated. Use ‘login_headertext’ instead.
2.1.0 Introduced.

User Contributed Notes