Please add following code
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'category__and' => array( 2, 6 ),
'posts_per_page' => 1,
);
$arr_posts = new WP_Query( $args );
OR
$tax_query = array(
relation => 'AND',
array(
'taxonomy' => 'category',
'field' => 'term_id', // 'term_id' by default, so just here as an example
'terms' => 186,
'include_children' => false, // true by defualt
'operator' => 'IN' // 'IN' by default, so just here as an example
),
array(
'taxonomy' => 'category',
'terms' => 187,
'include_children' => false, // true by defualt
)
)
Related Posts:
- 404 Error On Category and Tags Pages
- Block multiple categories from Blog
- If newest post of category is newest post in general, skip first post of category
- How to create button to direct to certain category
- WordPress Genesis not excluding category from blog
- Putting a Category of posts under a Page
- how to “not” display new posts with a specific category on the main page?
- Functions.php: Exclude Category from “Blog”
- How can I display tags as categories?
- Display content from a specific category using cat ID not working
- Display subcategories in dropdown
- Hide a category of posts from main blog, and only show in category view
- Add code to header based on category for specific posts?
- Use blog as base for tags and categories
- Restrict CSS on one page
- Rebuilding a Site: How to Show Several Category Posts in Woo Framework Theme?
- excude a specidic category from showing in the “relative posts”
- Category post count is not correct
- How to create category filter on a blog like on the site below?
- Is it possible to set up blog categories without changing permalink structure
- Redirect Category pages to blog page with query string
- Read More showing only on first post
- List post categories that link to a page showing those posts
- Pages, Categories, and working with someone else’s code
- Multiple Categories under one URL, where ‘Front Page’ is used already
- Restricting certain blog posts by date?
- Can I set a default featured image for a category?
- What’s the URL for a category archive?
- Weird behaviour when adding terms/term_taxonomies programmatically
- How can I get category ID by category name?
- Randomise results from a category page?
- Is there a way to have duplicate category slugs?
- Multiple level category drop-down
- Adding Custom User Profile data based upon Categories
- Order posts by category name
- How can I make wp_list_categories output li with category-slug as class, for its children?
- Remove word “Category” from WooCommerce product page [closed]
- Show post only if match all categories
- Output link to category from WP_Query loop of woocommerce products
- Password protect a specific category page/post
- If in category to be inside of a function
- How to exclude posts from a category when using this particular format
- Different excerpt styles per category, but chronological
- Show only one category
- Pagination Not Working on Category.php page
- How to view WordPress’ default category IDs?
- Filter Home Page Posts in Buddypress [closed]
- Broken category pagination
- Additional featured post on first page
- Color different for the current category
- Displaying a full post instead of a slug per category?
- one category template for multiple categories
- Display posts separated by Category in Author’s page
- How can I define a custom archive for childs of a specific category?
- How do I toggle pagination on/off in search results and category listings via a link?
- Category shows only top level child categories
- List categories with custom code
- Page display certain Category Posts
- REST API: Display Category names in JSON?
- List posts in alphabetical order
- Where is the category of a post stored?
- Categories list loop – add separator every 3 categories [closed]
- Add image to each podcast series (or category) in headless WordPress instance [closed]
- wp_list_pages() exclude category
- How to define multi categories posts number
- Get the ID of 10 Latest Pages stored in a WordPress Category
- Trying to get variables in hacked category dropdown
- how to separate categories in loop.php?
- How can i remove the posts category class names from body_class
- Different Category Headers using in_category and elseif
- Insert HTML content in WP Query at specific point
- Get posts of a custom post type from category from taxonomy?
- How can I ask to an existing category?
- ACF no print data [closed]
- Change categories count to include media attachments
- How to Sync Menu, Widgets and other masters from Main Website to its Sub Site
- Show category meta in loop on homepage
- How to get selected taxonomy or category ID if using custom walker?
- How can I check which archive has referred the single? [closed]
- How to hide widget from certain category
- Category link redirect to custom template page instead of index.php?
- Split multiple categories into two columns
- the_category() doesn’t working in wp_query loop
- Add class to current post in query_post
- separate posts to have (kind of) 2 blogs?
- Sort posts by child category name
- Automatically add custom taxonomy to posts in a category
- Get category base permalink
- Template category.php with page (no posts)
- WooCommerce showing active product categories on single product page
- how to exclude specific category types (uncategorized) from blog page?
- How to set featured image as background for a specific category?
- Confused about category.php template – not working
- Adding relevant categories to related post
- How to assign image on specified category and not show the image on other categories
- How can I add a Categories page link to a menu? [closed]
- Way to show content of a post, but if exceeds character limit revert to excerpt?
- get posts from 2 categories. (2 posts)
- Converting Categories (with ACF fields) to custom taxonomies
- Why does my WordPress index has a category?