admin管理员组

文章数量:1201413

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' )
        )
    )
);

本文标签: wp queryAny quicker alternative for WPQuery quotNOT INquot