钩子文档

enable_login_autofocus

💡 云策文档标注

概述

enable_login_autofocus 是一个 WordPress 过滤器,用于控制是否在登录屏幕上打印 wp_attempt_focus() 函数调用,以管理登录表单的自动焦点行为。

关键要点

  • 这是一个过滤器,允许开发者修改是否在登录屏幕输出 wp_attempt_focus() 调用。
  • 参数 $print 是一个布尔值,默认为 true,表示默认启用自动焦点。
  • 在 WordPress 4.8.0 版本中引入。

代码示例

if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) {
    // 代码逻辑
}

📄 原文内容

Filters whether to print the call to wp_attempt_focus() on the login screen.

Parameters

$printbool
Whether to print the function call. Default true.

Source

if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) {

Changelog

Version Description
4.8.0 Introduced.