你的tax_query
不正确。taxonomy
不接受数组。
taxonomy (string) - Taxonomy.
http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
你需要重写你的论点
the following from the Codex:
$args = array(
\'post_type\' => \'post\',
\'tax_query\' => array(
\'relation\' => \'AND\',
array(
\'taxonomy\' => \'movie_genre\',
\'field\' => \'slug\',
\'terms\' => array( \'action\', \'comedy\' )
),
array(
\'taxonomy\' => \'actor\',
\'field\' => \'id\',
\'terms\' => array( 103, 115, 206 ),
\'operator\' => \'NOT IN\'
)
)
);
$query = new WP_Query( $args );
您可以稍微自动化一下:
$taxonomies = array(\'miss_behave_category\',\'emily_category\',\'gemma_category\',\'poppy_category\');
$args = array(
\'post_type\' => array( \'post\', \'miss_behave\', \'emily_davies\',\'gemma_patel\',\'poppy_smythe\' ),
\'category__not_in\' => 4
);
$args[\'tax_query\'][\'relation\'] = \'OR\';
foreach ($taxonomies as $tax) {
$args[\'tax_query\'][] = array(
\'taxonomy\' => $tax,
\'terms\' => array(141,142,143,144),
\'field\' => \'id\',
\'operator\' => \'NOT IN\'
);
}
// var_dump($args);
$the_query = new WP_Query($args);
然而,“类别”是一种分类法,所以您也可以将其与其他分类法以及所有这些分类法一起包括在内
NOT IN
s不太可能非常有效。我会仔细考虑这些需要包括在哪里。