Filter hook 'login_body_class'

in WP Core File wp-login.php at line 197

View Source

login_body_class

Filter Hook
Description
Filters the login page body classes.

Hook Information

File Location wp-login.php View on GitHub
Hook Type Filter
Line Number 197

Hook Parameters

Type Name Description
string[] $classes An array of body classes.
string $action The action that brought the visitor to the login page.

Usage Examples

Basic Usage
<?php
// Hook into login_body_class
add_filter('login_body_class', 'my_custom_filter', 10, 2);

function my_custom_filter($classes, $action) {
    // Your custom filtering logic here
    return $classes;
}

Source Code Context

wp-login.php:197 - How this hook is used in WordPress core
<?php
 192  	 * @since 3.5.0
 193  	 *
 194  	 * @param string[] $classes An array of body classes.
 195  	 * @param string   $action  The action that brought the visitor to the login page.
 196  	 */
 197  	$classes = apply_filters( 'login_body_class', $classes, $action );
 198  
 199  	?>
 200  	</head>
 201  	<body class="login no-js <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
 202  	<?php

PHP Documentation

<?php
/**
	 * Filters the login page body classes.
	 *
	 * @since 3.5.0
	 *
	 * @param string[] $classes An array of body classes.
	 * @param string   $action  The action that brought the visitor to the login page.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-login.php
Related Hooks

Related hooks will be displayed here in future updates.