Filter hook 'enable_login_autofocus'

in WP Core File wp-login.php at line 1621

View Source

enable_login_autofocus

Filter Hook
Description
Filters whether to print the call to `wp_attempt_focus()` on the login screen.

Hook Information

File Location wp-login.php View on GitHub
Hook Type Filter
Line Number 1621

Hook Parameters

Type Name Description
bool $print Whether to print the function call. Default true.

Usage Examples

Basic Usage
<?php
// Hook into enable_login_autofocus
add_filter('enable_login_autofocus', 'my_custom_filter', 10, 1);

function my_custom_filter($print) {
    // Your custom filtering logic here
    return $print;
}

Source Code Context

wp-login.php:1621 - How this hook is used in WordPress core
<?php
1616  		 *
1617  		 * @since 4.8.0
1618  		 *
1619  		 * @param bool $print Whether to print the function call. Default true.
1620  		 */
1621  		if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) {
1622  			$login_script .= "wp_attempt_focus();\n";
1623  		}
1624  
1625  		// Run `wpOnload()` if defined.
1626  		$login_script .= "if ( typeof wpOnload === 'function' ) { wpOnload() }";

PHP Documentation

<?php
/**
		 * Filters whether to print the call to `wp_attempt_focus()` on the login screen.
		 *
		 * @since 4.8.0
		 *
		 * @param bool $print Whether to print the function call. Default true.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-login.php
Related Hooks

Related hooks will be displayed here in future updates.