I need to add body class from termmeta in woocommerce category This code did not work for me:
function lalka_custom_taxonomy_in_body_class( $classes ){
if( is_singular() )
{
$custom_terms = get_term_meta($meta_id, 'custom-class', true );
if ($custom_terms) {
foreach ($custom_terms as $custom_term) {
$classes[] = 'custom-tax-' . $custom_term->slug;
}
}
}
return $classes;
}
add_filter( 'body_class', 'lalka_custom_taxonomy_in_body_class' );
How can I do it?