WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/login form defaults

Description

login_form_defaults filters the default login form output arguments. It is part of the function wp_login_form()

Parameters

$defaults
(array) (required) An array of default login form arguments.
Default: None

Examples

The following example changes the default labels in the wp_login_form() function:

add_filter( 'login_form_defaults', 'my_login_page' );
function my_login_page() {
	$args = array(
		'label_username' => 'Enter Username',
		'label_password' => 'Enter Password',
		'label_remember' => 'Remember Login State',
		'label_log_in'   => 'Please Log In',
	);
	return $args;
}

Notes

The defaults set in the wp_login_form() function are as follows:

$defaults = array(
	'echo' => true,
	'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
	'form_id' => 'loginform',
	'label_username' => __( 'Username' ),
	'label_password' => __( 'Password' ),
	'label_remember' => __( 'Remember Me' ),
	'label_log_in' => __( 'Log In' ),
	'id_username' => 'user_login',
	'id_password' => 'user_pass',
	'id_remember' => 'rememberme',
	'id_submit' => 'wp-submit',
	'remember' => true,
	'value_username' => '',
	'value_remember' => false, // Set this to true to default the "Remember me" checkbox to checked
);

Change Log

Since: 3.0

Source File

login_form_defaults is located in wp-includes/general-template.php

Related

  • login_form_defaults