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
- Modify WordPress Search
- Can wp_query return posts meta in a single request?
- Broken? WP_Query and “attachment” as a post type
- How to use the_posts_navigation for wp_query and get_posts?
- How to paginate attachments in a secondary query as gallery?
- How to make an activities stream mixing posts and comments?
- using wp_query to return posts w/ comment count > 0
- How to hide post content/meta from everyone except the post author and admin
- Too many posts cause slow load when paginating
- Order Posts by meta value AND published date
- How to reduce the number of queries?
- Query custom post type by custom taxonomy (category slug)
- get posts by meta_key from inside key of post meta
- Help optimizing slow WP_Query with meta_query
- Query Vars Not Set in Main Query
- Order post type by sum of two custom fields
- construct complex queries with WP User Query
- How can I detect if the current post is in this loop?
- wpquery via ajax
- Pagination problem by using WP_Query
- Where is this query?
- Is there ANYTHING about this query that’s incompatible with WordPress 2.9.2?
- get all images from the wordpress media library with link to the post they are associated with
- Custom Taxonomy – Modify Function to Get Child Category
- WP Query – grouping posts by same meta key, adding together values from another key
- Pass post ID to JavaScript outside the loop
- Query for current post
- Why does my output of get_the_ID() change after a wp_query?
- WP Query works outside a function, not inside a function
- Pull posts from all categories if quantity is not met?
- Query_post 5 post first / last of post_id
- Multiple tax_queries: display posts titles from several custom taxonomie
- Using URL variables on a custom WP_Query
- How to query images from a post to use in a slider
- Show parent’s child and also child’s, child on a page?
- Pagination not working in some author pages
- wordpress query from multiple post id
- Custom search: Search posts but display parent page in results
- Displaying specific posts from query thumbnail outside div
- How to display only top posts of parent categories in loop via WP_Query?