I have a issue with wordpress meta query.
I make a checkbox in meta box, When user check the check box the post is become featured. Now I call all posts except featured, but I don't get it.
Here is my code:
$wa_story_args = array(
'post_type' => 'stories',
'posts_per_page' => 999,
'orderby' => 'DESC',
'meta_query' => array(
array(
'meta_key' => 'wa_featured_story',
'meta_value' => 'featured',
'compare' => 'NOT IN'
)
)
);
Just replace "meta_value" by "value" and "meta_key" by "key":
Try using the '!=' operator instead of 'NOT IN' as this is usually used to check against arrays.
You should also consider adding a OR 'NOT EXISTS' condition.