You can use the category__in parameter and that will do exactly what you’re looking for.
Related Posts:
- I need to exclude from a query a category and a few custom taxonomies
- Get all categories and posts in those categories
- Combine two taxonomies in a hierarchical tree
- How to get posts from two categories with WP_Query?
- Group WP_Query by category
- Exclude categories from search query
- How can I reduce the number of database query calls for this custom homepage?
- WP_Query not looking at child category
- Get page content by category or tag
- Excluding posts from a category but only if they’re not in multiple categories
- What could be causing my wp_query pagination to break?
- Custom query with category exclusion and post-meta “whitelist”
- Use Transient API to cache queries for all posts in all categories?
- Return array of categories to php function
- Exclude most recent posts from specific category in wp_query()
- Listing all posts from current category on page
- Display WooCommerce product categories in a 4 columns custom menu [closed]
- Display one latest post from multiple categories
- How to Check if a Child Category is Being Queried
- How to run WP_Query to retrieve attachments to posts only from a particular category?
- Show post only if match all categories
- Dropdown category filter
- How to query posts from specific authors and categories using WP_query?
- How to show in search results posts with a particular tag in a particular category?
- Custom WP_Query for current category (in category.php)?
- List Posts by Category for a Non-Zero, Non-NULL Custom Field Value?
- getting content from main domain to sub-domain using category and WP_Query
- WP_Query() returns null when results exist!
- Ignoring a category in WP_Query still shows the links in next_post_link()?
- 3 Columns, 3 Categories, One Archive, and Pagination
- Enter a variable in the ‘category_name’ parameter
- How to query post like normal search would do. within search.php page
- Resort get_categories
- Multiple Loops on category.php with pagination on last loop
- How to get latest posts from each category in regular order
- change recent posts based on category
- How to remove specific categories from posts?
- How to use an array of categories as a dropdown?
- Redirect to another page using contact form 7? [closed]
- Create menu locations for each category in wordpress
- Set colors depending on category
- Combine results of multiple WP_Query to resemble single WP_Query
- Display posts from a category
- Custom loop of a single category, cannot order by date. What am I missing?
- Pagination on category.php and tag.php not working
- category__not_in and id values from variable
- Array: What is this value based on?
- How to get an array with all categories and corresponding names?
- Link To Child Category For A Post
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- Need to echo category id in multi-dimensional array
- Related Posts Excluding Certain Categories
- Getting Category Children
- WP_Query – using category__and when one of the categories is 0
- More efficient way to list posts by category [duplicate]
- Adding a block with query in homepage
- Query posts by views on category page
- Show multiple categories in query using redux framework variable
- Are term_taxonomy_id and term_id the same? [duplicate]
- Return category posts with WP_Query
- Using in ‘category_name’ in ‘$query->set();’?
- multiple values in an array for category__and does not work with WP_Query
- Custom Page Template Category loop not functioning correctly
- Retrieve post tags from from main wp_query
- Posts of specific category on page and excluded from index.htm
- new WP_Query issues
- Using multiple variables to assign categories to an array
- How can I use AJAX with check-box categories?
- Select posts that match multiple category names, must match all categories listed
- the_category() doesn’t working in wp_query loop
- How to display the 5 latest post titles but allow only 1 in there of a specific category
- What code to use in an array to call the current sub-category?
- Cant get unique_array() work on get_the_category() foreach loop
- Unable to get all tags from specific categories
- category__and works, but why?
- foreach,having wp_query inside, breaks after showing one result
- Display related posts with same category or same tag return blank
- $args Orderby The number
- Querying Multiple Categories With Different Offsets
- WordPress Numeric Pagination with Query String [duplicate]
- Printing direct descendants of a category with WP_Query
- Custom Category Page Not Working [duplicate]
- Matching usermeta at registration to categories of content
- WP_query exclude a category unless it has more than one catagory
- Show only one category in main query, issues on tag page
- Multiple Categories under one URL, where ‘Front Page’ is used already
- How do i add custom post types to this query?
- How to change category id on get_posts array
- Narrow Down a Shop Page Results Based on a Product Tag in WooCommerce
- How to retrieve posts from parent category, splitting them per children when displayed?
- Trying to WP_Query a category
- How to define category ID in an array?
- Order Categories by Character Count
- how do I exclude a category foreach
- Is there a plugin that will completely remove the category system?
- How do you remove display of WooCommerce product category on single product page?
- Show recent posts in menu?
- wp_list_categories with show_count, except for specific categories
- Difference between wp_list_categories and get_categories
- Listing Post Categories on Home Page