When registering a custom taxonomy, register_taxonomy()
accepts an update_count_callback
argument.
This callback function will be called when the count is updated. The default callback is _update_post_term_count()
for taxonomies attached to post types, which confirms that the objects are published before counting them.
_update_generic_term_count()
is the default for taxonomies attached to other object types, such as users.
You can check out the code for both functions to see how you can create your own callback to make the count more accurate.
Related Posts:
- Taxonomy list. Order by a specific custom post type count
- Adding categories to custom post type in permalink
- How to change permalink structure for custom post type and it’s taxonomies?
- Get the first post term
- How to show all posts of the category in wordpress?
- WP_Query by a category id and a custom post_type
- Filtering a custom post type by custom taxonomy in archive template
- Why are posts from custom post type not displayed in “category” archive?
- Add Category Taxonomy Support to Custom Post Type
- Exclude a category from WP_Query
- Get category id from post id of a custom post type
- Custom Post Types on Category Pages
- Displaying category archive of custom post types
- Adding Categories to a WordPress Custom Post Type?
- Setting Default Category for Custom Post Type Upon Autosave
- Creating “static” taxonomies to choose from, inside custom post type?
- How to display regular posts & custom post types that fall under a category using just the generic category template?
- Taxonomy count per Post type
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How to build a complex page structure
- WP_Query ignores post_type in category view
- Add category to custom post URL
- Only list categories that contain posts of a specific custom post type
- Custom Posts Types using Posts Category
- Load custom posts with same tag as page
- How to filter custom post types by custom category taxonomy
- Count posts or custom post types from last 24 hours (or from today)
- Hide/Show only specific categories in wp-admin new-post.php
- Is there a way to use regular categories with custom post types?
- How to list all categories and tags in a page?
- Count posts that have specific taxonomy term attached
- Count post that have specific meta value
- category__in not working on custom post type
- Pagination not working with custom category template
- Get categories for a specific post – Custom post type
- remove support for ‘Categories’ for a custom post type
- Remove date and category filters when editing custom post types
- how do I group content in magazine-style ‘issues’?
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- Glossary with Custom Post Type
- How can you make permalink work for custom post type and taxonomy?
- Include custom post types in categories widget
- Custom-Taxonomy as categories: Remove “most-used” tab?
- Filter get_categories() for taxonomy term in WordPress
- Categories assigned to custom post type not found
- How to get a list of term names of the custom post type im currently on in single.php
- Use standard WordPress categories with a CPT
- How to get dynamically custom post type that are under a certain category
- taxonomy list display custom post count
- Anyway to assign custom post types to a specific category?
- List with categories, subcategories and posts of custom posttype
- Template tags to display custom post type posts in category template?
- Add filter to wp_list_categories and query what type of taxonomy-terms it use?
- Regex problem in an add_rewrite_rule
- Count custom post types with a specific meta value
- Custom Post Type Category List & Post Count
- Listing and accessing categories for a custom post type
- How to show related posts by category or custom post type?
- Categories or Custom Post Type to Organize Content
- wp_list_categories and custom post types
- How can I add single catogory for custom post type?
- On clicking on the category name the page is redirecting on 404 pge
- Hook onto Add New Category
- Custom Post Type, Two categories, Two columns with Pagination
- Structuring a product catalogue in WordPress [closed]
- New WP_query in template not working with CPT+category on some pages
- Custom edit post column – category not showing
- Displaying custom post type on category pages but not on blog listings
- WP Query group/order by category name
- Automatic category for a Custom Post Type
- Get the post_type of current taxonomy or category page
- How to show custom taxonomy in the permalink?
- Get count of custom post type created by current user
- Change / Delete the default post type and category?
- List all custom post type posts from a given category?
- How to customize the Categories meta box to allow only one category?
- Restrict categories to a custom post type
- Custom post type taxonomy template
- Categories and Tags not working!
- Custom/separate categories for custom post type
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- WP_Query with custom post_type and cat retrieving unwanted posts with the custom posts
- How can i list custom post type categories?
- Query Custom Post by Category
- Is there a way to list posts of only a certain category
- Taxonomy structure of Sport site
- Loop through categories and create tab for each
- automatically save custom post type title as a category
- Categories not working as expected with custom post type
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Getting all custom posts with a certain category
- get_terms won’t display product_cat or any other custom taxonomies when specified
- How to display the categories of the post? (custom post type)
- Page naming when there is a sub-category only sometimes.
- get custom post type categories
- Query custom post types
- How to display recent / random posts by its category
- Display Custom Category (taxonomy) Name in Custom Post Type
- How to get category image custom post type taxonomy in wordpress?
- next_post_link and previous_post_link in custom post type single page, in same non-custom category