Using WordPress ‘login_footer()’ PHP function

The login_footer() WordPress PHP function outputs the footer for the login page.

Usage

login_footer($input_id);

Custom example:

login_footer('user_login');

Parameters

  • $input_id (string) – Optional. Which input to auto-focus. Default: ”

More information

See WordPress Developer Resources: login_footer()

Examples

Outputs the default login footer on the login page.

function my_custom_login_footer() {
    login_footer();
}
add_action('login_footer', 'my_custom_login_footer');

Auto-focus on the username input

Sets the focus on the username input when the login page is loaded.

function my_custom_login_footer_username() {
    login_footer('user_login');
}
add_action('login_footer', 'my_custom_login_footer_username');

Auto-focus on the password input

Sets the focus on the password input when the login page is loaded.

function my_custom_login_footer_password() {
    login_footer('user_pass');
}
add_action('login_footer', 'my_custom_login_footer_password');

Remove the auto-focus from the inputs

Removes the auto-focus from any input field on the login page.

function my_custom_login_footer_no_focus() {
    login_footer('');
}
add_action('login_footer', 'my_custom_login_footer_no_focus');

Custom input field for auto-focus

Sets the focus on a custom input field when the login page is loaded.

function my_custom_login_footer_custom_input() {
    login_footer('my_custom_input');
}
add_action('login_footer', 'my_custom_login_footer_custom_input');