wp query – Any quicker alternative for WP_Query “NOT IN”
Question
I am using the following wp_query
to pull up a list of post, and I want to exclude a few categories of a custom taxonomy.
It works well, however Query Monitor is telling me that the query is slow.
I removed the 'tax_query'
part of the query and it sped up.
Is there a faster way to exclude these categories?
Thanks!
My Query:
$args = array(
'post_type' => array( 'recipe' ),
'post_status' => array( 'publish' ),
'order' => 'DESC',
'orderby' => 'date',
'posts_per_page' => 40,
'no_found_rows' => true,
'tax_query' => array(
array(
'taxonomy' => 'ingredients',
'field' => 'slug',
'operator' => 'NOT IN',
'terms' => array( 'onion', 'pepper', 'bean' )
)
)
);
0
9 months
2022-05-09T01:19:38-05:00
2022-05-09T01:19:38-05:00 0 Answers
0 views
0
Leave an answer