0

Possible Duplicate:
WP_Query with checkbox meta_query

Ok, so I have a custom post type and have used the Verve Meta Boxes plugin to create some custom meta values for the post type.

The meta box is called 'Subjects' and has a checkbox list of subjects to assign values to it. For example, I have ticked Math, English and Science.

Now I want to perform a WP_Query which will take an array of subjects selected by the user as an array, compare those subjects to those selected for the custom post type, and return posts if any of them match.

Here's the code so far:

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

$args = array(
            'post_status' => 'publish',
            'post_type' => 'any',
            'meta_query' => array(

         // Not sure what type of meta query to do   

            )
        );


$query = new WP_Query($args);

To cut a long story short, I just need to know if there's a way to perform a meta_query which will compare an array against whatever format the data in the meta box is in?

If this is not possible, I just need to know then I'll look at a different way of doing it, but I'm thinking there's perhaps some meta_query ability I don't know about.

Any help would be much appreciated.

0

1 Answer 1

0

My question was fantastically answered on Wordpress Stack Exchange:

WP_Query with checkbox meta_query

Not the answer you're looking for? Browse other questions tagged or ask your own question.