Wordpress Query Compare operator not working?

Posted by Liam on Stack Overflow See other posts from Stack Overflow or by Liam
Published on 2012-04-16T11:17:56Z Indexed on 2012/04/16 11:28 UTC
Read the original article Hit count: 173

Filed under:
|

I have the following wordpress query...

             $args = array('orderby' => 'meta_value_num', 'meta_key' => 'order', 'order' => 'ASC',
            'meta_query' => array(
            array(
                'key' => $customkey,
                'value' => $customvalue,
                'compare' => '='
            ),
            array(
                'key' => $customkey1,
                'value' => $customvalue1,
                'compare' => '='
            ),
            array(
                'key' => 'coverageRegion',
                'value' => 'national',
                'compare' => '='
            ),
            array(
                'key' => 'vehicleType',
                'value' => 'psv',
                'compare' => '!='
            )
            )
            );

I want to return posts where there custom field 'Vechicle Type' is not PSV, The above however returns posts with exactly that, has anybody come across this before?


Seems im not the only one neither... http://wordpress.org/support/topic/meta_query-without-key-results-in-compare-of-not-like-not-working

© Stack Overflow or respective owner

Related posts about php

Related posts about Wordpress