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
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Querying Posts by Taxonomy From Alternate Network Site
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- WordPress Genesis custom taxonomy archive shows 3 repeats of each post
- Custom taxonomy in URL showing 404
- getting all values of a custom taxonomy if there is no post
- How to duplicate entire custom post type
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- Custom post type permalink tag 404
- How to get list of taxonomy slugs ordered parents>childs?
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Template for custom post type when taxonomy is in the URL
- How to query custom post type by two terms?
- Query custom taxonomy for category including children
- Auto Generate Post Title from 2 Custom Fields
- How do you create pillar content pages?
- Grid slider with custom post type (how to filter with taxonomies?)
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Facing some Issues on Two Parts Custom Post Type Taxonomy Names
- Shortcode display CPT Query only showing 1 post?
- Get Registered Custom Post Type to get All Custom Taxonomies
- Parent cpt/child custom post type URL permalink relationship
- How to make a single Menu Item call another Mega Menu for Custom Post Types and Custom Taxonomies?
- Dynamically count the number of custom post types associated to a custom taxonomy