W3cubDocs

/WordPress

do_action( 'login_head' )

Fires in the login page header after scripts are enqueued.

More Information

You can customise the login form using login_head fairly easily.

Add the following code to functions.php in your theme:

// custom login for theme
function childtheme_custom_login() {
	echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/customlogin.css" />';
}
 
add_action('login_head', 'childtheme_custom_login');

This has the effect of adding a reference to a stylesheet to your login form.

You will then need to add a stylesheet called customlogin.css to your theme directory.

For testing purposes, this should start you off:

html {
background-color: #f00;
}

This should produce a login background.

Here we replace the standard WordPress logo with our logo, taken from our theme (this uses get_stylesheet_directory_uri to work with child themes):

function my_custom_login_logo() {
     echo '<style type="text/css">                                                                   
         h1 a { background-image:url('.get_stylesheet_directory_uri().'/images/login.png) !important; 
         height: 120px !important; width: 410px !important; margin-left: -40px;}                            
     </style>';
}
add_action('login_head', 'my_custom_login_logo');

To set the URL of the login icon’s link, see login_headerurl

Source

File: wp-login.php

View on Trac

Changelog

Version Description
2.1.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/login_head