Add Custom CSS Class to Body Tag

If you want to add one or more custom classes to the <body> tag, you can use the snippet below:

add_filter( 'body_class', 'extend_body_class' );

function extend_body_class( $classes ) {
    $classes[] = 'custom-class';
    return $classes;
}