The issue is you are overriding the entire tax_query
. When you go to the UK category archive, tax query is set to have the same thing you have for International, but you are nuking the current query. Here is the solution:
...
$tax_query = $query->get('tax_query');
$tax_query['relation'] = 'OR';
// puts the item at the beginning of the array instead of the end.
array_unshift( $tax_query, array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'intl',
'operator' => 'IN'
);
$query->set( 'tax_query', $tax_query );
...
Related Posts:
- When/why does ‘$query->get( ‘tax_query’ );’ return empty?
- Multiple terms not working on taxonomy
- Get Terms by IDs with IDs order
- Search Terms – Querying on either description__like OR name__like in the same Term Query?
- Custom query to get terms from post ids
- Empty tax_query array returns an empty array
- wpdb->term_taxonomy count posts from both published and private posts?
- Post with certain term and without any term
- Order posts by date, but also give priority for a specific term
- Order terms by count – missing terms
- How can I get the name of term post meta value which equals term id
- Sort query_terms_list for post_tags alphabetically
- List only parent attributes on woocommerce admin atrributes page
- How to do a sql like query on serialized data of user meta data
- Order WordPress Query by Custom Field While Still Using Tax_query Argument
- modifying main query to query for ranges e.g. from 1999 to 2016
- No results for taxonomy archive page
- How can I create a meta_query with an array as meta_field?
- Query multiple meta key values?
- Is there a way of increasing the speed of this query?
- How can I query all users who registered today?
- Reversing the order of posts AFTER the query is performed
- what are the numbers between curly brackets in search query
- How to get link and title of next and previous post on single page
- Search custom post type by meta data
- Multipart/formatted MySQL query problem
- Remove [gallery] shortcode altogether
- query multiple taxonomy and show post count
- Categories and products in random order
- When add_query_arg() is necessary?
- Insert html after certain amount of posts?
- wp remove query
- Filter query posts by the count of metas for a meta key
- $wpdb->get_var not returning a result
- $args numberposts variable
- Dynamically tax_query terms
- Save default value for empty or missing post meta
- Listing posts by grouping dates
- $wpdb->query() vs. $wpdb->get_results() vs. phpMyAdmin
- How to mass delete one line from all posts after site hack
- Query posts by content lenght
- $wpdb doesn’t appear to work on page inside of a plugin
- Taxonomy archive showing no results
- How to export current year posts from WordPress?
- Search query -> Show all pages except certain template
- How do I see the mysql query generated by get_posts( $args )?
- List related terms + taxonomies
- WordPress Query wp-terms SLOW
- I can’t figure out what’s wrong with this statement. $wpdb->query update
- Different values for get_author_posts_url and get_the_author (posts 2 posts)
- Problem when try to add ++1 for user meta
- query statement containing variable won’t execute
- Very complex post query
- Get posts from category with custom query
- Related post based on content
- Slow Search Queries – How to exclude pages, media, excerpt, authors, private posts?
- How to interfere to default search to make it search in custom fields?
- WP_User_Query with more than two custom meta values
- Declaring a var, placing it in a query and using the output of the query?
- how do i register global query in template
- Combining two meta_values within one row with query
- How to get the term description in a taxonomy term archive query?
- Target a page with query
- Merge CPT Taxonomy and Post Taxonomy in $query->set
- How do I get specific readable results from this query and array results
- PHP Warning: Attempt to read property “slug” on bool in tax query
- I want to get on those users their meta value are like “AGENT” .. but this query is not working
- Add rewrite rule for archive search
- How to create a filter and add query params to all links
- Get 2 meta values from meta key column
- WordPress add_query_arg from ajax and make url friendly
- My custom pagination not displaying
- Wpdb->last_query returns bad query
- WP search exclude last letter from string
- Are there any best practices for creating a Like/Favourite feature in WordPress using custom MySQL tables and without any plugins?
- Query reversed when I use “category__not_in”
- How to reduce the load / no of queries on MySql Database
- $query->set( ‘post_type’, ‘post’ ); not working
- How i make a custom sql query for Woocommerce
- Display result from custom post meta query
- Show certain number of post from tags
- Wpdb empty result only if language is Russian
- Include custom table in query
- How to fix this insert? Don’t work for me!
- Display Upload Author & Get Uploaded Post ID
- Display list of most recent grandchild (third tier) pages
- How can I display a number to represent the order of post?
- Update vs Insert logic but the last key is always inserted?
- Sort order in get_posts [closed]
- Query unique author ids with published post of type job
- Tax query array terms display out of order
- Wpdb generates too many queries
- Custom Query for searching through custom fields
- Query posts alphabetically within this function
- Conditional Tag Custom Querys?
- query posts only works on the first page
- Custom Query for wp_posts using wp_postmeta
- WP Query outputs three items within a div
- Query filter on custom post by current author in post widget for elementor query id
- Querying Posts from ACF Repeater Subfield Select Value