[wp-trac] [WordPress Trac] #45076: Category counter is not updated

WordPress Trac noreply at wordpress.org
Mon Jul 28 10:17:10 UTC 2025


#45076: Category counter is not updated
-------------------------------------------------+-------------------------
 Reporter:  mukesh27                             |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Taxonomy                             |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing has-screenshots dev-   |     Focuses:
  feedback has-patch                             |  administration
-------------------------------------------------+-------------------------

Comment (by hbhalodia):

 Hi @mukesh27, @sourav08, @strangerstudios,

 In addition to incrementing the category count when adding a term, it is
 also necessary to decrement the count when deleting a single term to
 ensure accuracy.

 I have observed that for both add and delete operations, we trigger an
 AJAX call to insert or remove the term from the site. Upon successful
 completion, the term count should be updated accordingly by incrementing
 or decrementing by one, utilizing the `count` value already displayed on
 the current page.

 Please find the pull request implementing this functionality here:
 [PR](https://github.com/WordPress/wordpress-develop/pull/9336)

 That said, there are a couple of points to consider:

 1. When new tags are added, the count is initially hidden. To display it
 properly, we need to apply styles dynamically via JavaScript to remove the
 `display: none` attribute.
 2. When the count changes from singular to plural or vice versa (e.g.,
 from "1 item" to "2 items"), the current logic only appends 's' to form
 the plural, which does not accommodate localization. Since `item/items` is
 a localized string, pluralization varies across languages. Consequently,
 handling this pluralization programmatically based on the count is not
 feasible within the current framework. This issue also applies in reverse
 when decrementing from plural to singular.

 Please let me know if you have any suggestions or further insights on
 handling the localization nuances.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45076#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list