You can use this code for getting number of posts in a taxonomy:
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'your-taxonomy-name',
'field' => 'slug',
'terms' => 'some-slug',
)
)
);
$query = new WP_Query( $args );
echo $query->post_count;
Related Posts:
- Hiding an Advanced Custom Field based on Taxonomy Field selection
- get_the_terms error
- Advanced Custom Fields displaying on tag pages
- Exclude posts which have any term in a certain taxonomy from the query
- Query Custom Post Type by Taxonomy Meta Value
- Repeater + taxonomy: same value in every field
- Query Custom post type with Taxonomy Custom Field
- Get terms in hierarchical taxonomy
- Tax Query trouble
- Exclude taxonomy term from list of current taxonomy terms
- Get ACF taxonomy term and sub-term lists ACF blocks
- Query Two Different Taxonomies Nested
- ACF Taxonomy in Loop
- How to display acf repeater in tag archive page?
- I need posts within a taxonomy category that are tagged “featured” to show up first
- Get taxonomy url, name, post count & image
- Related Posts by taxonomy using Advance Custom Fields Plugin
- Adding Advanced Custom Fields to posts without hyperlinks
- Can One Taxonomies Terms be Ordered by A Seperate Taxonomy?
- How to perform unit testing on proposed patches in Trac?
- Can the default “post tags” taxonomy be renamed?
- How to add images to taxonomies?
- Add ‘Description’ to taxonomy ‘Quick Edit’
- get a specific taxonomy term name
- get_terms() How many is TOO many?
- Child Terms not Displaying on the Taxonomy Term Admin Screen
- SQL QUERY needed to get POST category (taxonomy) ? – MUST be SQL statement
- How to display child term of current term’s parent taxonomy?
- Sorting custom taxonomy causes menus error
- How to add terms to taxonomy with wp_insert_terms?
- Is there any difference between post in child term and child & parent terms?
- Create and move terms for taxonomies
- How can I remove links from the function “get term list”?
- Alphabetical order in taxonomy.php
- Get Term names from WP Term Object
- functions to create term and child terms
- base directories / URL
- WordPress REST get all items without a taxonomy assigned
- How to display custom taxonomy in multiple columns?
- Custom taxonomies making WP very slow – Way to fix?
- Exclude specific taxonomy term when using wp_get_post_terms
- How do I get the current tag out of a taxonomy?
- Sorting taxonomy columns by meta value numeric
- If search matches taxonomy
- ACF vs Taxonomies
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Custom Field as Custom Taxonomy?
- Order wordpress taxonomy parent terms by their children count
- Modify the query method when adding category filtering function to the custom post list
- Taxonomies on custom taxonomies
- need to get postthumnails from a post whithin a category custom post type
- Group Post by Custom Taxonomy 2 under Custom Taxonomy 1
- Individual post. Meta_key, taxonomy or post status for separation?
- Taxonomy archive page WP_Query does not return get_the_permalink() or get_permalink() value
- Ordering Taxonomies / Changing term_id
- How to show taxonomy image instead of taxonomy name on a list
- benefits of the table ‘wp_term_taxonomy’
- How to save a multiple checkbox array into a non-hierarchical taxonomy
- Redirect to another page using contact form 7? [closed]
- `get_terms()` with `child_of` and `childless` combined
- Add text to the end of each list item in wp_list_categories
- echo term name outside the loop, using term slug
- What are these undocumented arguments for register_taxonomy?
- Dynamic filtering of posts with custom taxonomies
- Sorting tags by name
- How to get terms from a custom taxonomies after WordPress 4.5.0
- Search Media by taxonomy
- Get Taxonomy name from “registered_taxonomy” hook
- I have custom post type with custom taxonomy. But not found the taxonomy page..
- In two-category searches, where does WordPress save the title of the 2nd category?
- Show only first child in dropdown
- Custom Post Type + Custom Taxonomy = Archive Listing Page Problems
- Taxonomy term archive default loop returns 1 record instead of 8
- Related terms – Terms that feature in post of current term
- Select query with two and two related taxonomies
- Taxonomy Dropdown Question
- Why do my quick edits for custom taxonomies not show on the post frontend?
- Customize menu link for taxonomy in WP menu
- Change searching from world level to first letter
- How To Query For An Empty Taxonomy Field
- Is possible hide hierarchical select dropdown created by jetsmartfilters? (only visual issue)
- Display acf taxonomy attachment
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- Tracking the name of a custom taxonomy
- new custom filed not showing in taxonomy
- Search for single post by 2 tags
- Permalink URL connection between two custom types
- I want to edit the tags template by adding text that displays all tags from the listed posts
- Add specific content to a taxonomy results page
- Set the limit of taxonomy per page
- echo a tax term in loop
- How to manage the links of a new taxonomy
- Same page for startpage and archive?
- Taxonomy Terms That Don’t Exist Display Results
- how to print post tags [duplicate]
- Filtering posts by taxonomy and meta_value
- Help me add Taxonomy to byline
- How Can I List Categories by Date?
- Custom Taxonomy Page redirect 404
- Why is taxonmy-[taxonomyname].php not working?