Wordpress Query Compare operator not working?
- by Liam
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