WordPress.org

Codex

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

Plugin API/Filter Reference/login head

The login_head filter can be used to filter the logo image on the WordPress login page. By default this logo is of WordPress.

Note: this is not the only possible use of this filter. It can be used to add anything to the <head> section on the login page.

Usage

<?php add_filter'login_head''custom_function_name' ); ?> Where "custom_function_name" is the function to be called when the content is being retrieved.

Example 1

In the below example the default logo is changed to custom logo, using CSS.

<?php

function my_custom_login_logo() {
    echo '<style type="text/css">
	h1 a {background-image:url(http://example.com/your-logo.png) !important; margin:0 auto;}
	</style>';
}
add_filter( 'login_head', 'my_custom_login_logo' );

?>

Example 2

To validate the login details before user logins, you can use the below function :

(p.s. At first, you may have inserted some extra fields using 'login_form' action hook.)

function ref_access() {
    global $error;
    if(empty($_POST['custom_field_name']))
    {
    $error  = 'Restricted area, please login to continue.';
    }
}
add_action('login_head','ref_access');
This page is marked as incomplete. You can help Codex by expanding it.