[wp-trac] [WordPress Trac] #17019: add hooks for Media Library attachment counts

WordPress Trac noreply at wordpress.org
Thu May 15 19:26:12 UTC 2025


#17019: add hooks for Media Library attachment counts
-------------------------------------------------+-------------------------
 Reporter:  kevinB                               |       Owner:
                                                 |  SergeyBiryukov
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Query                                |     Version:  2.5
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests early       |     Focuses:
  needs-test-info                                |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-testing has-unit-tests early needs-test-info
     => has-patch has-unit-tests early needs-test-info


Comment:

 I'm checking this 14-year-old ticket and all I can see is that it's all
 over the place. A clear candidate to never been merged for all the wrong
 reasons.

 Let's try to handle it a bit

 1. First, the idea seems to be focused on one topic, but the code
 necessary to make it possible requires spreading changes in code in
 multiple files in multiple places. Generally, the philosophy should be 1
 ticket 1 topic and this should have been split 14 years ago. Since
 @wonderboymusic took over the patch, and focused just on the
 `gallery_attachment_count` part, to be closed, I think this report should
 exclusively focus on this.

 2. Second, although it has `unit-tests` I don't have clear how to use this
 or in which context use this. @hellofromTonya
 [gallery_attachment_count_query pointed this out] correctly back in the
 day. This is a clear scenario, where
 [https://make.wordpress.org/test/2025/05/15/building-the-testing-use-case
 /#the-hook a minimal use-case] to visualize the intention would be great.
 If anyone wants to take this post and close it, I would start from here.

 3. Last but not least, [https://github.com/WordPress/wordpress-
 develop/pull/1052.diff last patch] is not applying. Fixing it is pretty
 simple, but `unit-tests` are not passing. So it requires a little more
 work to be valid.

 Conclusion: A little snippet of code showcasing the thing and fixing the
 code to pass can clearly make this a suitable candidate for, first manual
 testing and then merging and shipping.

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


More information about the wp-trac mailing list