body_class filter-hookWP 2.8.0

Filters the list of CSS body class names for the current post or page.

Usage

add_filter( 'body_class', 'wp_kama_body_class_filter', 10, 2 );

/**
 * Function for `body_class` filter-hook.
 * 
 * @param string[] $classes An array of body class names.
 * @param string[] $class   An array of additional class names added to the body.
 *
 * @return string[]
 */
function wp_kama_body_class_filter( $classes, $class ){

	// filter...
	return $classes;
}
$classes(string[])
An array of body class names.
$class(string[])
An array of additional class names added to the body.

Changelog

Since 2.8.0 Introduced.

Where the hook is called

get_body_class()
body_class
wp-includes/post-template.php 836
$classes = apply_filters( 'body_class', $classes, $class );

Where the hook is used in WordPress

Usage not found.