I have two custom taxonomy 'cities-taxonomy' and 'userfeed-taxonomy' and I am excluding all the post which has these taxonomies assigned in my blog page using pre_get_post();
Here is my query
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'
),
));
}}
Now what I want is that if
featured
category is assigned in addition to above taxonomies that post must not be excluded from query.
Any help appreciated, may be some other method I can alter the blog page query to achieve this ?