harish1988
harish1988

Reputation: 114

Single Meta key with multiple values not working in searching

I have search query where i am using single meta_key with multiple values but its not working . here is the meta query .

[meta_query] => Array
    (
        [0] => Array
            (
                [key] => _vital_lighting_color
                [value] => Array
                    (
                        [0] => red
                        [1] => green
                        [2] => blue
                    )

                [type] => char
                [compare] => IN
            )

    )

but its not fetching record i don't what's happening can you please check it . Thanks

Upvotes: 0

Views: 649

Answers (1)

Lumiere de Lune
Lumiere de Lune

Reputation: 141

Using proper php syntax would help :

$query_args = array(
   'meta_query' => array(
                'key' => '_vital_lighting_color' ,
                'value' => array
                    ('red' , 'green' ,'blue' ) ,
                'compare' => 'IN'
            )
    ) ;

I removed type, because "char' is the default value

If it does not work, then run a query on the database directly to check you have posts

Upvotes: 1

Related Questions