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 to display SQL query that ran in query?
- How can I create a meta_query with an array as meta_field?
- Query multiple meta key values?
- How to Optimize WP site for millions of posts
- Retrieve posts by term id custom query
- How to get comments by post ID?
- Differences between wpdb->get_results() and wpdb->query()
- tax_query in get_posts() not working?
- Is there a way of increasing the speed of this query?
- Get all image from single page using 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
- simple sql query on wp_postmeta very slow
- Using WordPress public query variables
- How to Use Wildcards in $wpdb Queries Using $wpdb->get_results & $wpdb->prepare?
- How to get link and title of next and previous post on single page
- Create pagination and order according to alphabet
- wpdb get posts by taxonomy SQL
- How to List Events by Year and Month Using Advanced Custom Fields?
- Is there any difference between hooks posts_where with posts_join and posts_search performance wise?
- wordpress query – orderby child post date
- How many WordPress SQL Queries per page?
- How to display Section for certain time
- Add multiple value to a query variable in WordPress
- Search custom post type by meta data
- Custom query_var causes displaying posts archive on front page
- Slow wp_enqueue_media()
- Multipart/formatted MySQL query problem
- What is the most efficient way of implementing a favorite post system?
- Remove [gallery] shortcode altogether
- Compare two numeric custom fields
- Why is my WP_Query not working when tax_query terms are an array?
- get_terms with posts that have a different taxonomy with term x
- wp_dropdown_categories with multiple select
- Advanced Custom Fields – Query Efficiency
- Why does get_the_time(‘F j’) return November 30 for all posts?
- Query by one meta_key and sort by another (possibly NULL value)
- How to tune search argument in WP_Query to show only exactly the same results?
- Custom query filter not working on woocommerce category page
- How to delete a transient on post/page publish?
- Very slow query
- query multiple taxonomy and show post count
- How to find objects by terms
- Query & Sort Comments by custom comment meta
- How to create a WP_Query to search the Title or Tag?
- How to get my loop to pull posts into three columns
- How to display lastest post date in the homepage?
- Custom $wpdb Query for Custom Post Type by Category
- Get a user’s most recent post title
- Categories and products in random order
- Custom Search | Wrong output & question
- add_query_arg() XSS Vulnerability
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Count user posts by user ID, Post type and Post status
- Can’t pass table to $wpdb->prepare
- $query->query_var[‘post_type’] not set for pages
- is_archive() doesn’t work on public query var archive pages?
- How to extract all ID variables from a query string?
- When add_query_arg() is necessary?
- Different Main Navigation per category
- How to get category link without a database query
- Insert html after certain amount of posts?
- wp remove query
- Show recent products first but “sold out last” in query
- WordPress creating excessive joins on meta_query with search
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- How to display liked posts of current user in wordpress?
- Ordering Posts with Custom Taxonomy Terms Array
- Filter query posts by the count of metas for a meta key
- How to tell if $query_var isset?
- Show All Posts Insert Edit Link
- How to Get All Taxonomies AND All Terms For Each Taxonomy With Post Count Zero
- $wpdb->get_var not returning a result
- tax_query: What to pass when I want to have all terms?
- search through post-type attachments titles
- How to count get_users query?
- Date query year and month OR just year
- cron job to auto delete posts of a specific post type older than x days
- Possible to get posts from multiple meta keys/values in a single query?
- Are database queries created using WordPress filters protected from SQL injection?
- Get IDs of posts currently visible on archive
- Get posts by category with pure SQL query