Not sure why this works, where the other query was failing. I’m not sure if it’s a bug that others are experiencing or not. Anytime I included any category “inclusive” arg, it broke my meta_query, but it didn’t seem to if i was “excluding” categories. So,…making an array of all category ids, then unsetting the categories I wanted to “include” in the query. Then set array as the ‘category__not_in’ arg seems to be working.
I’d still love any kind of insight as to why this is happening. Thank you.
$cats = get_all_category_ids();
$removeKeys = array(8,10,11,12);
foreach($removeKeys as $key) {
if (in_array($key, $cats))
{
unset($cats[array_search($key, $cats)]);
}
}
$args = array(
'post_type' => 'post',
'meta_query' =>
array(
array(
'key' => 'wpcf-featured',
'value' => -1,
),
array(
'key' => 'wpcf-news-expire-date',
'value' => $today,'compare' => '>=',
),
),
'category__not_in'=> $cats,
'posts_per_page' => 1
);
$alertloop = new WP_Query( $args );