Changing:
$args = array (
'category__and' => $cats
);
to:
$args = array (
'category__in' => $cats
);
Does the trick.
Related Posts:
- WP_Query not looking at child category
- Display one latest post from multiple categories
- Enter a variable in the ‘category_name’ parameter
- Multiple Loops on category.php with pagination on last loop
- Pagination on category.php and tag.php not working
- category__not_in and id values from variable
- More efficient way to list posts by category [duplicate]
- Show multiple categories in query using redux framework variable
- the_category() doesn’t working in wp_query loop
- WordPress Numeric Pagination with Query String [duplicate]
- Printing direct descendants of a category with WP_Query
- Custom Category Page Not Working [duplicate]
- How do i add custom post types to this query?
- Display single category name in woocommerce loop
- Show Posts from Single Category Not Working
- Is there a reason I cannot get the current category in a loop?
- Category archive is displaying all posts rather than the specific category
- Display posts from a category
- Custom loop of a single category, cannot order by date. What am I missing?
- new WP_Query all post in a category inside the loop
- Trying to get variables in hacked category dropdown
- Problem with different query loops (and “main loop”) on category template page!
- How to do paging in the loop?
- How to add orderby parameter for sorting on category.php
- Use premade array as categories in wp_query?
- How to loop custom post_type from (a) specific category(ies)?
- Do not show sub categories in the loop on archive-product.php
- wp_query is showing posts from other categories
- How to display the parent category if only the child category has been chosen
- Category tags with comma’s
- Display posts of certain categories to specific user roles
- Allow user to select categories that will display in post loop
- Insert HTML content in WP Query at specific point
- Do not duplicate posts with multiple categories in multiple loops
- Simple way to style posts of a single category differently in the loop and in single
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- WP_Query with one category in args shows other categories
- Getting the Most Recent Posts from Multiple Categories
- Display subcategories in dropdown
- Display category title and three latest post inside the category
- WP_Query – using category__and when one of the categories is 0
- Adding a block with query in homepage
- Query posts by views on category page
- Have posts that belong to multiple categories, exclude some categories from homepage
- Category nicename inside loop in wordpress
- I need to exclude from a query a category and a few custom taxonomies
- Get the ID of the current post’s child category
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- Are term_taxonomy_id and term_id the same? [duplicate]
- WP_Query of Category Not Showing First Post
- Return category posts with WP_Query
- Using in ‘category_name’ in ‘$query->set();’?
- Custom Page Template Category loop not functioning correctly
- Retrieve post tags from from main wp_query
- Limit Loop to One Category
- Display post thumbnail for specific category outside the loop
- List post only under the category, exclude child category content
- Posts of specific category on page and excluded from index.htm
- new WP_Query issues
- Filter Category Loop Dynamically
- How can I use AJAX with check-box categories?
- Editing Loop So It Targets Specific Tags?
- Select posts that match multiple category names, must match all categories listed
- Conditional category query breaking?
- Problem: retrieving parent category’s first post
- How to display the 5 latest post titles but allow only 1 in there of a specific category
- How to get posts using category slug in ClassiPress?
- Category sticky latest
- Posts made to category don’t show up (do show up on frontpage)
- Exclude posts without category from loop
- Category name for all posts getting assigned to a single random post
- Category post count is not correct
- Display all categories but only if they have posts in them that have a specific tag assigned
- Function the_posts_pagination() not compatible with WP_Query arguments
- Include last post date in get_categories loop
- Show the number of the post
- How can I order all subcategories alphabetical independent of the parent categories?
- How to get specific (grand parent) category of current post?
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- Custom Loop with certain number of one category
- how tho change number of posts in loop from specific categories
- Template category.php with page (no posts)
- Get categories within specific term
- error in specific category loop
- How to show specify category template for both parent and child category
- loop in single.php of the same category
- How to create a category loop on my blog (ACF Plugin)
- Please tell how to stop the category from showing up on posts
- Hide a category/posts from the homepage in wp
- Loop by category and meta_key
- Display 3 levels of categories on page
- I have 3 categories, i want to display on a loop the last 3 of every category
- Assign a class to first element in category in loop
- Displaying Category in sidebar post widget but not in the loop on home
- Only show current category post
- Querying posts from two different categories while looping inside another loop
- Trying to display all posts in a category
- Retrieving category pages from subcategory returns empty sets