我有两个自定义分类法“cities taxonomy”和“userfeed taxonomy”,我排除了所有在我的博客页面中使用pre\\u get\\u post()分配这些分类法的帖子;
这是我的问题
add_action( \'pre_get_posts\', \'my_filter_main_query\' );
function my_filter_main_query( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$terms1 = get_terms( array( \'userfeed-taxonomy\' ), array( \'fields\' => \'ids\' ) );
$terms2 = get_terms( array( \'cities-taxonomy\' ), array( \'fields\' => \'ids\' ) );
$query->set( \'tax_query\', array(
\'relation\' => \'AND\',
array(
\'taxonomy\' => \'userfeed-taxonomy\',
\'field\' => \'id\',
\'terms\' => $terms1,
\'operator\' => \'NOT IN\'
),
array(
\'taxonomy\' => \'cities-taxonomy\',
\'field\' => \'id\',
\'terms\' => $terms2,
\'operator\' => \'NOT IN\'
),
));
}}
现在我想要的是如果作为特色的
除了上述分类法之外,还分配了类别,不能将post从查询中排除。
感谢您的帮助,我是否可以通过其他方法更改博客页面查询来实现这一点?