1
I have the following query
, where the conditions are informed from a array
:
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'ignore_sticky_posts' => true,
'category_name' => $atts['category_name'],
'posts_per_page' => ($atts['number'] > 0) ? $atts['number'] :
get_option('posts_per_page')
);
$meta_query[] = array(
'key' => '_featured',
'value' => 'yes'
);
$args['meta_query'] = $meta_query;
$the_query = new WP_Query($args);
That one query
brings me the posts
which are marked as Featured
.
But what I need is the reverse, I need the posts
who are not Featured
.
If I just put 'no'
in place of 'yes'
, in that passage:
'key' => '_featured',
'value' => 'yes'
He only returns to me posts
that once were featured
. But those who have never been, do not appear, because they neither possess the meta_key featured
.
The easiest thing would be to bring the posts
different from "featured = yes"
, but I don’t know how to do it.
And if you leave the
'Value' => ''
??– Marcos Henzel
Or something like that:
$meta_query[] = array(
 'key' => '_featured',
 'key.count' => 0,
 'value' => 'no' 
 );
– Marcos Henzel
if I leave it: 'Value' => '' returns nothing.
– Nathalia Negrão