body_class
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[] $css_class An array of additional class names added to the body. * * @return string[] */ function wp_kama_body_class_filter( $classes, $css_class ){ // filter... return $classes; }
- $classes(string[])
- An array of body class names.
- $css_class(string[])
- An array of additional class names added to the body.
Changelog
Since 2.8.0 | Introduced. |
Where the hook is called
body_class
wp-includes/post-template.php 859
$classes = apply_filters( 'body_class', $classes, $css_class );