You can do it like below-
$query = get_posts(
array(
'category__and' => array(
6, // Your category-1 ID
7 // Your category-2 ID
// And so on and so fourth
)
)
);
Now in $query
variable you’ll get the object of posts which are in both Category 1 and Category 2 and so on and so fourth.
Hope that helps.
Related Posts:
- How do I apply style to each category of a list?
- Redirect to another page using contact form 7? [closed]
- Categories from front-end, checkbox selection doesn’t work
- Visual composer custom element error
- How can I display a list of only categories which are marked as ‘featured’ in the backend?
- Is there a way to combine categories and their hierarchy into the admin listing page?
- Plugin to restrict non-admin user to existing tags
- Combine two taxonomies in a hierarchical tree
- Way to force media uploader use custom image size
- Restrict access and display for categories
- How to add terms to a post depending on its title?
- Plugin for changing a post’s category based on it’s post date?
- Woocommerce category description as subtitle
- Get subcategories with JSON API plugin
- How to display a category list in a mediawiki like way?
- How to show custom static content at top of each category page?
- How to use get_categories() with Event Organiser plugin
- Server-side subscribe by email?
- plugin for wp_list_categories with posts
- Mixed unrelated taxonomy in permalink
- Custom Post Type Plugin not loading category template and loading 404 instead
- Display content from custom post type if match to main post category
- How can i list random post from multiple category?
- My Category is too big on the Menu what can i do?
- Getting a List of Categories for Use in a Plugin?
- Not able to open category post [closed]
- WordPress category add image field
- Easy Digital Download Sub category
- Solutions to repost categories into multisite blogs?
- Assign post format to categories
- Using WP Category Lists Plugin to Dynamically Display Category (PHP)
- Events Plugin that works with existing categories?
- Trouble with editing template for “List category posts” plugin
- Any built-in function to associate a post to category through a plugin?
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Search for categories
- Preg Match All doesn’t Allow echo first character for WordPress Taxonomy Tags
- How do I get fresh post data in post_publish hook?
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- How to set taxonomy in custom plugin?
- Automatically Assign Author to Category [closed]
- polylang + category/tag custom language link
- WordPress “Categories to tags converter” not working. Pointing to import.php instead
- How to check if a taxonomy not exists in a plugin
- Recent posts per category loop?
- Taxonomy Drill-Down / Plugin Help – hierarchical queries within plugin?
- How do I rename a category in the menu bar only?
- Ambrosite Next/Previous Post Link Plus or WP next_post_link to cycle through top level category
- Is changing post from category in a large blog a good practice?
- How to set category correctly for a custom post created by a remote API call?
- How to add category and subcategory in WordPress custom code?
- WooCommerce Hiding A Certain Category From Being Displayed On Single Product
- How can recognize post’s category?
- How to get the get the select values created by ACF plugin in wordpress
- How can i listing current category and Featured Category post list?
- How to get Recent Post From Each Category with Thumbnail?
- Category “same post” retreive and display
- how to create hierachial taxonomy and manage under single post type?
- Add a new category for posts
- how to show all posts of each category in pages
- Custom Post Type same name as Category
- How to display the category name in the tab and post inside the tab in WordPress?
- Getting the same post on my related post
- What plugin would make this happen? If is the theme
- how can I edit the HTML of yith ajax product filter
- Unset plugins on front-end belonging to specific category
- Can I retain custom taxonomy data when uninstalling a third-party plugin that created it?
- WordPress Categories as a Grid
- How to allow editors to only edit certain categories?
- Category as Subdomain for One WP Install
- Exclude Tag Links from and Text
- Woocommerce categories displayed on every category and shopping page
- woocommerce product search based only title
- Ajax Load More on Hierarchical Categories
- Sub Categories in drop down menu
- How to create groups like that in buddypress?
- How to insert category name above post title in a featured pages plugin?
- WordPress Categories from Plugin
- Show all posts of all categories but excluding a category on custom blog page with pagination of my theme
- Showpost and last
- Is it possible to setup Category wise Subsciption?
- Filter EVERY category link with my plugin
- Category archive in menu
- CSV file header
- Find And Add Category to Posts
- Retrieve post thumbnails
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Editing “Kahi’s Highlight Used Categories” plugin code – highlighting parent and child category in post page
- wp_insert_post_data filter to set category
- 404 not found problem with URL rewrite custom category
- Automatically set posts to NoIndex depending on category?
- Make a Custom template for a specific category in wordpress
- woocommerce retriving category name as div class?
- query_vars in plugin when using custom permalinks
- How to pre-set WordPress settings for specific posts?
- Create WordPress category dynamically
- Can i have limit posts on a specific category and automatically remove older ones?
- Failed to update a post when I add a taxonomy to it
- Categories not showing when all of the posts are private
- How to add portfolio category post count in main navigation menu?