Do a tax-query and then count the result. No need for a custom query with dozens of JOINS.
$posts = new WP_Query( array(
'post_type' => 'MYPOSTTYPE',
'tax_query' => array(
array(
'taxonomy' => 'TAX_1',
'field' => 'slug',
'terms' => array( 'TERM_TAX_1' ),
'operator' => 'IN'
),
array(
// etc.
)
),
'post_status' => 'publish'
);
prinft(
'<h3>COUNT: %s</h3>'
,count( $posts )
);
Related Posts:
- Error get_posts with Custom Taxonomy and OR relation
- tax_query showing no results
- Taxonomy: Why ‘with_front’ => false DOES NOT WORK?
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Assign posts to taxonomy terms instead of the taxonomy terms to posts?
- Get terms that contain posts that in turn belong to other terms?
- The Operator “NOT IN” Does Not Work In tax_query
- Exclude from search all custom posts which are NOT in a taxonomy term
- Custom SQL Query on Custom Post Type. Order by Taxonomy?
- Order posts by (hierarchical custom) taxonomy terms and term children
- Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)
- Combine tax_query and meta_query in WP_Query
- Count number of posts which exist in 2 taxonomies?
- Want to filter only parent post in admin area
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- using custom taxonomies on non wp table?
- WP_Query tax_query on ACF post_object
- Paginated Taxonomy Term Archive including one post per term
- Query to change custom post type with specific category
- Query for custom post type objects in a taxonomy and with a meta value
- wpdb custom post_type problem
- Query Multiple Taxominies Across Multiple Post type’s
- Insert post metadata for all posts in CPT at once if metadata no existent
- Get posts by querying taxonomy and certain terms of the taxonomy?
- Convert simple SQL Query to WordPress query
- Custom post type templating problem
- using $wpdb to get custom post type with term
- Custom Post Type Taxonomy Filters
- Tax query not producing any results
- How to Filter custom post type by taxonomy?
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How to conditionally redirect to the post from a taxonomy page?
- How do I display the grand child items of a taxonomy term?
- Get terms that contain posts that in turn belong to other terms?
- How to group posts and get a mixed posts and groups view?
- How to display Related Posts based on number of taxonomy terms matched
- tax_query not working in template
- WP_query – Filter by tax_query and meta_query using multiple select
- How to list tags from custom post type attachments?
- WP_Query parameter conflict
- How to get_term_meta on single custom post?
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- tax_query (if the terms are empty)
- I have custom post type with custom taxonomy. But not found the taxonomy page..
- Convert Custom Taxonomy Posts to Normal Posts
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Custom Post type Query by Taxonomy
- Single.php for Custom Post Type > Taxonomy > Term
- $wpdb is queried but results don’t show
- How to display posttypes and taxonomy in standard posts, not in a separate label?
- “Menu order” being ignored when querying posts from a parent taxonomy with “include_children” set to true
- ACF – Retrieve custom taxonomy from a relationship field
- Display related CPT with custom taxonomy
- custom post type and a “sticky” position taxonomy
- How to select custom posts thats are tagged with multiple taxonomies using wpdb
- Filter in Custom post type to find the parent post
- How to search through all child taxonomies using WP_Query?
- Custom post type and custom taxonomy key lenght & query performance
- Display Custom Field or Custom Taxonomy in front page /post/product
- WP_Query not using custom taxonomy categories on custom post type
- Custom search for a custom post type in WordPress
- Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies
- How can I get the last 5 element of this tax query?
- tax_query not working?
- Getting Custom Posts with Custom Taxonomy
- Showing taxonomies with terms that are attached to custom post
- Getting all custom post taxonomies and exhibiting only part of them
- WP Query tax_query not returning posts
- How to show post which has the specific taxonomy terms?
- Get list of CPT posts in *current* post’s taxonomy term
- Linking custom taxonomies and posts
- Storing/querying custom date data
- Create a WordPress Database query to find users who purchased specific product through WooCommerce [closed]
- WP Query Conditionally query meta and taxonomy
- Change the Custom Taxonomy URL Slug pattern
- Losing Nav Active State in Menu
- Different rewrite rules for taxonomies and cp in multisite?
- Custom select query for taxonomies that have posts categorized in another taxonomy
- Custom Post Types Archives and Single Pages not showing custom taxonomy data
- How to setup a single post page for my custom post type?
- Implementing Pillar Posts; Long Posts yet with Some Page-Like Handling?
- Dynamically insert code to custom post type loop
- Custom taxonomy template list not working (404)
- Link From Single Post To Taxonomy Term Archive Page
- Issue with Custom Post Types and Single
- Calling related posts to a custom post type, taxonomy & Tag id
- How to create subdomain for custom post type and associated custom taxonomies
- Should I use a custom taxonomy or custom post type for grouping a list of panels associated with a group of tests?
- Remove custom taxonamy slug with pagination
- Taxonomies are not showing in the category dropdown
- get_the_terms child terms for current post/custom post only
- Custom Taxonomy – fields
- CPT Loop, include taxonomies and disclude others?
- Populate custom post type/custom fields from an external database
- Custom taxonomy- only output relevant terms
- Post types showing tables…Can I do that?
- Dropdown switching subcategories portfolio
- Prevent repetitive terms in get_the_term_list
- Displaying posts exclusively in their category (not parent)
- Category / Custom Post Type permalink issue