I’m guessing you are using a tax_query
here.
If you try to query multiple categories or taxonomies, the terms field expects an array
$args = array(
// other query arguments
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'id',
'terms' => array($cats_or_tags),
),
),
);
Related Posts:
- Show posts without term
- Why is my WP_Query not working when tax_query terms are an array?
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- List taxonomy terms plus their latest post ordered by post date
- Get random terms
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Order terms inside a select dropdown
- Get array of current post term ID’s
- How to add terms to my tax_query based off of the current post
- Change default ordering of taxonomy terms – pre_get_terms
- Empty tax_query array returns an empty array
- Pass array of taxonomy terms to wp_query
- Get list of terms that have posts in another term
- Formulate a url to show posts with both taxonomy terms
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Order by slug in get_terms with multiple taxonomies
- WordPress Related Post by tags in Single.php
- Function get_queried_object() return NULL in custom taxonomy
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Get authors by term id or slug
- How to order posts by title after they have already been sorted by category
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Taxonomy order exception for specific term
- Filter Custom Taxonomy Posts
- Get posts from multiple tax terms
- How to Order a list of taxonomies? orderby?
- get_the_terms – but only show 4 Posts
- How to add custom meta to ‘pre_get_terms’?
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- How to print term name inside wp post loop
- Using WP_Query for categories instead of get_terms
- Check if a post has term inside loop
- Grabbing taxonomy terms and inserting them into an array
- Deleting terms from the WordPress wp terms table
- Can’t get term id for category archive
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- How to make a post with certain taxonomy term display first before other post with only one query?
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Only show tag with the same id as the post
- display ACF repater field in archive page
- Save queried result into database
- WP Query by 4 different taxonomies
- Get categories within specific term
- How to display Woocommerce products list by tag
- taxquery taxonomy get terms
- get term objects and post objects in query
- How to show terms from another taxonomy
- How to define a custom hierarchy for terms?
- Add a custom variable to query page object
- How to get several fields from wp_query?
- query only direct child and sub-terms of a current term archive
- Get access to all terms associated to each post that the wp_query loop displays
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- I need to get all categories from a WP_Query
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Set Alias for meta_query arguments in get_posts()
- How can I use order_by to order by two meta_keys without excluding posts that don’t have those keys initialized?
- WP_Query meta_query where meta value ends in space
- Highlighting Sub topic in a post?
- wp_query for the first sticky, then display the rest of the posts excluding the first sticky
- WP_Query with many meta_query arguments taking a long time to load
- Slow speed and high CPU usage for my code. How to improve it?
- Multiple queries on Home Page – page load/site speed issue
- query attachments of parent page if attachments of current page are smaller than …
- Why is this coming back as null? Thats wrong. There is one post
- Retrieve featured image (thumbnail) url from multiple posts with one query
- WP_Query tax_query problem
- wp_query() get_col error
- WP_query posts closest to todays date
- Setting get_queried_object
- How to orderby multiple meta fields if some fields are empty
- Wp_query calculate points
- WP Query – Outputting JSON and normal loop of posts
- get data match with extra field value using wp_query for custom post
- Append URL query to next post link in custom query
- How to compare a date in custom field with today’s date in custom WP_Query?
- Shortcode for custom query not returning results when attributes are added
- wp_query is showing posts from other categories
- Page navigation doesn’t seem to work when I add offset?
- it’s possible make a WP_Query with math operations?
- show posts with range meta key
- is_404() – where does this get set?
- wp_query on page template not working (Genesis framework)
- WP_Query Pagination
- Where my home page and font options has gone?
- meta_query compare > not working
- 404 page on custom search pagination
- Query string order by custom field
- Paging works correctly on local version, but not live?
- Paginate nested query of child posts
- Display all Custom taxonomy terms and their relevant custom posts
- Display images with same specific value?
- How return normal search result using wp_ajax action for wordpress
- Custom post types loop on a page template
- How to efficiently find “duplicate” posts, where the titles are different, using metadata to match posts?