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

Plugin API/Action Reference/login head

This page is marked as incomplete. You can help Codex by expanding it.

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;}                            
add_action('login_head', 'my_custom_login_logo');

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

Further information.