php - Exclude / Not equal multiple values in wordpress query -
i have modified wordpress query.
i need exclude 3 values cannot figure out how it. have read lots of people passing more 1 value match not exclude. have tried several things across several hours.
$popularpost = new wp_query( array( 'posts_per_page' => '12', 'cat' => $cat_id, 'posts_type' => 'post', 'paged' => $paged, 'meta_key' => 'post_price', 'meta_value' =>'swap', 'free', 'wanted', 'meta_compare' => '!=',
any appreciated.
there issue here:
'meta_value' =>'swap', 'free', 'wanted',
in case meta_value
set swap
. free
, wanted
separate entries in array. writing code out reveals problem:
array( 'posts_per_page' => '12', 'cat' => $cat_id, 'posts_type' => 'post', 'paged' => $paged, 'meta_key' => 'post_price', 'meta_value' => 'swap', 'free', 'wanted', 'meta_compare' => '!=', ... )
i think want:
'meta_value' => array('swap', 'free', 'wanted'),
Comments
Post a Comment