Viewing 1 replies (of 1 total)
  • Thread Starter Mad Koala

    (@mad_koala)

    Ok, sometimes you just figure things out yourself

    To make query work for text ACF type and checkbox ACF type

    You should change this

    $value = explode(‘,’, $_GET[ $name ]);
    $meta_query[] = array(
    ‘key’ => $name,
    ‘value’ => $value,
    ‘compare’ => ‘IN’,
    );

    To this

    $values = explode(‘,’, $_GET[ $name ]);
    foreach( $values as $value )
    {
    $meta_query[] = array(
    ‘key’ => $name,
    ‘value’ => $value,
    ‘compare’ => ‘LIKE’,
    );
    }

    • This reply was modified 7 years, 5 months ago by Mad Koala.
Viewing 1 replies (of 1 total)
  • The topic ‘What’s wrong with my query? (Checkbox query doesn’t work)’ is closed to new replies.