Add a custom class to the body tag using custom fields
You want to use body_class filter. function prefix_add_body_class( $classes ) { global $post; // good to check if( ! is_single() || ‘post’ !== get_post_type() ) { return $classes; } $btag = get_post_meta( $post->ID, ‘tagbody’, true ); if ( empty( $btag ) ) { return $classes; } $classes[] = $btag; return $classes; } add_filter( ‘body_class’, ‘prefix_add_body_class’ … Read more