How can I outline in pre_get_posts
hook on customized publish kind to not execute the question on a taxonomy.
I’ve the next
if (!empty($newsType) && $newsType == 'press') {
//if $newsType exclude the taxonomy question and get simply the post_type
$taxQuery = [
[
'taxonomy' => 'news_type',
'operator' => 'NOT IN',
]
];
$this->query->set('post_type', ['press']);
$this->query->set( 'tax_query', $taxQuery );
} else {
$this->query->set('post_type', ['news', 'press']);
}
$newsType
is the $_GET
variable from request
If I do the next
unset($this->query->query_vars['news_type']);
the question will break with