login_head
Fires in the <head> section of the login/registration page (wp-login.php).
Scripts and styles, including those registered on the login_enqueue_scripts hook, are usually enqueued at this point. Other data, such as favicons, is also output here.
Usage
add_action( 'login_head', 'wp_kama_login_head_action' );
/**
* Function for `login_head` action-hook.
*
* @return void
*/
function wp_kama_login_head_action(){
// action...
}
Examples
#1 Add custom CSS to the login page
Change the background color of the login/registration page from gray to orange:
add_action( 'login_head', 'login_head_add_css' );
function login_head_add_css() {
?>
<style>
body {
background-color: #f78b53;
}
</style>
<?php
}Changelog
| Since 2.1.0 | Introduced. |
Where the hook is called
login_head
wp-login.php 127
do_action( 'login_head' );
Where the hook is used in WordPress
wp-includes/default-filters.php 392
add_action( 'login_head', 'wp_robots', 1 );
wp-includes/default-filters.php 393
add_action( 'login_head', 'wp_resource_hints', 8 );
wp-includes/default-filters.php 394
add_action( 'login_head', 'wp_print_head_scripts', 9 );
wp-includes/default-filters.php 395
add_action( 'login_head', 'print_admin_styles', 9 );
wp-includes/default-filters.php 396
add_action( 'login_head', 'wp_site_icon', 99 );
wp-login.php 50
add_action( 'login_head', 'wp_strict_cross_origin_referrer' );
wp-login.php 52
add_action( 'login_head', 'wp_login_viewport_meta' );