Tuesday, June 14, 2022
HomeWordPress Development{custom} area - Take away Physique Courses

{custom} area – Take away Physique Courses


I must take away particular physique courses added as a comma separated delimited checklist to a {custom} area enter area like this

wp-custom-logo, single-post, postid-28, single-format-standard, logged-in, admin-bar

Utilizing this code solely permits me to take away 1 class

add_filter('body_class', perform (array $courses) {

if ( ! is_singular(array( 'publish', 'web page' ) ) ) {
    return;
}

$body_classes = get_post_meta( get_the_ID(), '_remove_body_classes', true );

unset( $courses[array_search($body_classes, $classes)] );

return $courses;

});

This code works when making an attempt to take away 1 class on single posts however does not work when utilizing a comma delimited checklist and in addition does not work on single pages.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments