[wp-trac] [WordPress Trac] #64853: Inconsistent Post Count in Category Taxonomy
WordPress Trac
noreply at wordpress.org
Sat Mar 14 07:14:03 UTC 2026
#64853: Inconsistent Post Count in Category Taxonomy
-------------------------------------+---------------------------------
Reporter: phunsanit | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.9.4
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: ui, administration
-------------------------------------+---------------------------------
Changes (by maulikmakwana2008):
* keywords: has-patch => has-patch needs-testing
Comment:
**Correct patch category-count-fix.patch**
I have attached a patch that modifies wp-includes/taxonomy.php to include
the future post status in the default term count calculation.
Reasoning:
Currently, there is a UI inconsistency between edit-tags.php (which shows
only published posts) and edit.php (which shows all statuses the user has
permission to see). This leads to confusion for administrators who see a
count of '1' in the Category list but '2' items when clicking through to
the Post list.
Changes:
Updated the $post_statuses array in _update_post_term_count() to include
'future'. This ensures that scheduled content is reflected in the taxonomy
counts, providing a more accurate representation of managed content within
the Admin Dashboard.
Considerations:
Database Update: Existing counts will not update immediately upon applying
the patch; a term recount or post update is required to sync the database
values.
Front-end Impact: This will cause categories containing only scheduled
posts to no longer be considered 'empty.' While this fixes the Admin UI,
developers using hide_empty => true in front-end queries should be aware
that these terms will now appear, potentially leading to 'No posts found'
messages if the theme does not handle empty loops gracefully.
I've tested this locally, and it successfully aligns the counts once a
post transition is triggered.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64853#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list