WP_Query with checkbox meta_query

Take a look at the codex for a better understanding of queries of custom fields but it should look something like this:

$subjects_array = explode("_", $_GET["subjects"]);

$args = array(
    'post_status' => 'publish',
    'post_type' => 'any',
    'meta_query' => array(
         array(
            'key' => 'field_name',
            'value' => $subjects_array,
            'compare' => 'IN'
        ) 
    )
);


$query = new WP_Query($args);

Leave a Comment