So this code was working fine in mu-plugins until an update back in september or so...

function save_cookie_class( $classes ) {
    array_push( $classes, isset($_COOKIE['some_cookie']) );
    array_push( $classes, isset($_COOKIE['other_cookie']) );
    return $classes;
add_filter( 'body_class', 'save_cookie_class' );

Any ideas why it mightn't be working?

  • What's not working in the code?
    – Emil
    Dec 6, 2016 at 15:14
  • 1
    Your function will add either TRUE and FALSE, TRUE and TRUE, FALSE and TRUE or FALSE and FALSE to the body class - are you sure this is what you want?
    – Emil
    Dec 6, 2016 at 15:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.