Use WP_Query with Taxonomy Parameters. If you want posts that are in both categories, just add two conditions in tax_query (using an array for terms
will get you posts that have at least one of those categories).
Note that you’ll have to adapt the taxonomy to your needs. Instead of slug
, you could also use term_id
, term_taxonomy_id
or name
as the field to be searched.
$query = new WP_Query(
array(
'tax_query' => array(
array(
'taxonomy' => 'mytaxonomy',
'field' => 'slug',
'terms' => "females"
),
array(
'taxonomy' => 'mytaxonomy',
'field' => 'slug',
'terms' => "sport-fitness"
),
),
)
);
Related Posts:
- Order get_terms() By Custom Field
- How can I select a primary category?
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Removed slug from CPT, now How/where do I hook the filter to the taxonomy term archive pages link?
- Display empty taxonomy terms with get_terms()
- Get a list of Terms for a specific category
- Limit number of terms that a custom taxonomy can save per custom post type
- Get posts from specific taxonomy term
- Display custom taxonomy attached to the post on post single page
- Get Categories Where Taxonomy Equals ‘n’
- Showing HTML if Post is In Certain Taxonomy Term
- Post to inherit custom category background image from parent
- List taxonomy terms assigned to a post in hierarchical view
- Ordering terms whilst in loop
- Get WooCommerce product category list in functions.php
- Display List of Categories Within a Custom Taxonomy
- List Terms by category
- get_terms vs. get_categories: does it matter?
- Woocommerce get category image full size
- Control term order on a per-post basis
- Fixing category count
- Combine two taxonomies in a hierarchical tree
- Elegant way to add parent categories?
- Using URL parameters, list posts from category and custom taxonomy
- Send an email when custom post type category is changed
- Excluding posts from a category but only if they’re not in multiple categories
- How to convert regular categories to custom taxonomy?
- Update term count using a callback function
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Action hooks returning old category instead of new category
- Getting WordPress custom taxonomy/category?
- Order Taxonomy Term by date created
- How to get the number of child categories a specific parent category has?
- Get multidimensional array that reflects category hierarchy
- If statement within PHP echo
- Taxonomies for WordPress Media Library [duplicate]
- display taxonomy slug from term ID
- Custom Post Type Archive Page Filtering
- Can you pre-check wordpress categories?
- Display Taxonomy Terms in an option tag with value being the slug
- How to get the id from the custom category?
- How can i insert term in a specific language of Polylang?
- How to organize custom categories for filtering and selecting
- Custom sub taxonomy order by
- Is There a Difference Between Taxonomies and Categories?
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Get all media categories
- Getting category URL with hyphens, not spaces
- get_terms function not returning anything
- Get parent category id from child category page for custom taxonomy
- Why custom taxomony not showing when create a post?
- Get a count of how many times a term or a category is used in posts
- How to Link to Most Recent Custom Post of Same Term
- The Difference Between Categories and Tags and Taxonomies and Terms
- Custom page category taxonomy 404
- Getting Category Children
- Is it possible to create an alias/custom taxonomy for a category name?
- Same menu for different taxonomies to reach different content
- I need to exclude from a query a category and a few custom taxonomies
- Category link redirect to custom template page instead of index.php?
- How could I write a get_categories_by_year() function?
- Assign a custom post to a custom taxonomy based on custom field value
- Show single Child Category on Custom Post
- Custom Fields Value As Taxonomy
- How to get posts using category slug in ClassiPress?
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- Add properties to term object
- Page category filter in admin dashboard
- Sort categories by custom field in WordPress admin
- Automatically add custom taxonomy to posts in a category
- How to set the same base url for two different taxonomies?
- How to display custom taxonomy term specific post?
- How to get immediate children of a ‘term’ parent id through ‘get_terms’?
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- How can i echo next and previous custom category from a Taxonomy
- List non-empty categories from a custom post type
- How to load terms of a custom taxonomy of a product in woocommerce cart page
- Using heirarchial tags or Custom taxonomies
- Add subcategories posts to the counts column at the admin’s categories list
- Renaming default category taxonomy?
- Most efficient way to display current post subcategories?
- Categories and Tags Conflict after Woocommerce Installation
- Get category of a taxonomy for a queries object in a loop
- Dynamically creating content on custom URL without getting 404
- How to exclude category and post_tag taxonomy while displaying custom taxonomy?
- New Category – custom taxonomy
- How to add a post with new Taxonomy without assigning to default category?
- How to add additional field to Add new category part (without plugin use) [closed]
- Category and tags goes 404
- How to add a new child category via an SQL statement?
- How to create default categories in new installs?
- Why is my post categories not displaying?
- Check if value is a custom taxonomy category name
- Problem importing categories and sub-categories
- finding out the top 5 source ( source is a custom taxonomy ), in a given category
- Modify functions.php to add a term ‘uses-theme’ set to theme name on post save
- Use get variable when rewritten url in wordpress
- Issue on Listing Sub Product Categories In Woocommerce
- List the category tree of all the product_cat categories