Description
Taxonomy Terms Counter adds term counts to taxonomy panels in the editor sidebar for both Gutenberg and Classic Editor.
You can enable or disable counts per taxonomy and post type from the plugin settings page.
Source Code
Full source code is available on GitHub:
https://github.com/secretlab48/taxonomy-terms-counter
Notes:
– The settings page lists taxonomies that are available in REST for the selected post type.
– The plugin works on admin post screens for both Gutenberg and Classic Editor.
– If an existing post type is missing on the settings page, it likely has show_in_rest set to false.
– If a taxonomy is missing for a post type, it likely has show_in_rest set to false.
Hooks
The plugin provides the following hooks for customization:
PHP Filters
ttcounter_term_count_taxonomiesβ Filter taxonomies list for term counts. Args:$taxonomies,$post_type,$request.ttcounter_term_count_get_terms_argsβ Filterget_terms()args. Args:$args,$taxonomy,$post_type.ttcounter_term_count_valueβ Filter count value per term. Args:$count,$term,$taxonomy,$post_type.ttcounter_term_counts_responseβ Filter REST response. Args:$results,$post_type,$taxonomies.ttcounter_sanitized_settingsβ Filter sanitized settings before save. Args:$sanitized_taxs,$request.ttcounter_classic_hierarchical_labelβ Filter classic editor hierarchical label text. Args:$label,$term,$taxonomy,$post_type,$count.ttcounter_classic_hierarchical_item_htmlβ Filter classic editor hierarchical item HTML. Args:$item_output,$term,$taxonomy,$post_type,$count.ttcounter_classic_flat_term_labelβ Filter classic editor flat term label key. Args:$label,$term,$taxonomy,$post_type,$count.
PHP Actions
ttcounter_settings_updatedβ Fires after settings are saved. Args:$sanitized_taxs,$request.
JS Filters
ttcounter.termCountTaxonomiesβ Filter taxonomy list before REST request. Args:taxonomies,postType.ttcounter.termCountDataβ Filter REST response data before rendering. Args:data,postType.ttcounter.restrictedPostTypesβ Filter restricted post types list in settings. Args:restrictedPostTypes.ttcounter.restrictedTaxonomiesβ Filter restricted taxonomies list in settings. Args:restrictedTaxonomies.ttcounter.termCountLabelβ Filter sidebar label text. Args:value,{ name, count, label }.window.TTCounterClassicFilterLabelβ Filter classic editor flat checklist label text. Args:{ taxonomy, name, count, label }.
JS Actions
ttcounter.sidebarUpdatedβ Fires after sidebar counts update. Args:termsByTax.
Screenshots


Installation
- Upload the plugin to your
/wp-content/plugins/directory. - Activate the plugin through the βPluginsβ menu in WordPress.
- Go to βTaxonomy Counterβ to configure which taxonomies show counts.
FAQ
-
Does it work with custom taxonomies?
-
Yes, any taxonomy that is exposed to REST and enabled in settings.
-
Does it work with custom post types?
-
Yes. Enable per taxonomy in the settings page.
-
Does it work with the Classic Editor?
-
Yes. The plugin works with both Gutenberg and Classic Editor.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Taxonomy Terms Counter” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Taxonomy Terms Counter” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
2.0.0
- Added Classic Editor support for both hierarchical and non-hierarchical taxonomies.
- Added Classic Editor hooks for hierarchical and flat taxonomies.
- Added Gutenberg support for non-hierarchical taxonomies.
1.0.0
- Initial release.
