To get posts that belongs to all selected categories, you can make use of the category__and
parameter.
Example:
You can the following to your query arguments, this will only display posts that are in category 1 AND 2
'category__and' => array( 1, 2 ),
Related Posts:
- Setting Custom Sort Order of Posts within a Category
- How to change the layout and styling of posts according to their category in WordPress?
- Add default content to post (for specific category)
- Show One Category on Post
- Add custom field to category of custom post type
- Do I use custom post type or something else?
- Custom Theme Want To Remove One Category From All Displays
- Edit custom post type admin menu link
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- How can i limit the number of posts created per category?
- WordPress custom Query for Posts in Category display posts multiple times
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Set Default Category to Username
- if in category but only with post meta
- How to call posts under a specific category on static front page?
- Static pages not working
- How to display only one category in a custom post type?
- Can I style single post that are in multiple catergories?
- Custom post styling per category?
- Show custom post category for single post
- Add Categories To Custom Post
- Static text above category page
- Show a Category Specific Info Box
- Add default content to post (for specific category)
- Display ONLY Latest Post From Several Categories
- Taxonomy Category category.php not working
- Post’s arent displaying
- I have a website issue I am trying to resolve
- How to get the number of posts in a selected category?
- Add a checkbox to post screen that adds a class to the title
- Show related posts by category but ignore one category
- Attach pdf file to custom post type
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- Can I hide a specific post from latest posts page?
- How to show post(excerpt) from specific category on wp page?
- user contributed content as custom post types
- Remove custom posts that match taxonomy value
- WordPress – Admin Manage Posts – Multiple Filters by Parent Category
- Post Type Label Name
- wp_query ‘s’ parameter does not work with custom post type
- How to set up multiple taxonomies for groups of posts
- Blog Posts in Custom Menu
- How to display data in archive page?
- Can I divide the pages into categories?
- Duplicate posts and change category
- Category Foreach keeps looping?
- Custom Post Type – Category Rewrite – Remove Rewrite from Sitemap
- CPT archive redirects to single post
- display a random post thumbnail from a random category
- Turn On Comments On Custom Post Types in Directory Theme
- Duplicate Custom Post Type and Taxonomy Slug
- How to allow visitors to filter posts by multiple taxonomies
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- a little direction on custom post type
- How do I show posts from another wordpress installation?
- Create a custom posts page
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- Migrate posts from category and sub-category via SQL
- Display post number by category
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- register_post_type permalink
- Custom Post Limit for homepage only without plugin?
- How to get post with slug and exclude categories
- Adding a custom post type meta field to rss
- Help with listing current users submitted custom post type in template file
- Deleting old posts
- How To Use Custom Tax of a Post Type
- Categories Listing and Highlighting current category item
- Display hierarchical categories/sub-categories for a single post only
- get posts, run a custom query, and join the results
- search form for custom fields
- Some custom post types did not return an object
- Display Post from Custom Post Type with Shortcode
- Modified core/image rendering not showing in posts – only on pages
- Not display an image of category of custom post
- Why do I have categories with duplicate slugs?
- Post relationships/nesting
- Is it possible to remove actual post pages in wordpress but keep them in categories
- Displaying dynamic content (blog posts/portfolio) on a static homepage and keep the blog post styles
- WordPress not showing recent posts
- How to get post count including nested categories
- Multiple Custom Post Type loop logic
- How to show content of specific item on the same page?
- How can I display a specific number of post in a category via a url
- how to chang preview of list of articles of one category?
- Post of a specific category – not to be seen in paging previous/next post
- How to show main category related to that post
- Display selected category on post page
- Sort post by category using HTML Select tag
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to use in_category?
- About number of posts in selected category
- First Custom Post Custom Fields Empty After New Custom Post
- Category page shows “No Posts” but I do have two assigned
- ‘get_previous_post’ in same category returning (!empty) when no previous post in category exists
- How can I get on the same row two post of different categories?
- Filters do not work when there are multiple (one works)
- WordPress Custom Post type csv exporter
- Edit Page button is gone