[wp-trac] [WordPress Trac] #46350: If a term is '0' clicking on its "Count" value displays all posts

WordPress Trac noreply at wordpress.org
Fri Apr 26 22:21:47 UTC 2019


#46350: If a term is '0' clicking on its "Count" value displays all posts
-------------------------------------+-----------------------------
 Reporter:  jesin                    |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Taxonomy                 |     Version:  3.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+-----------------------------
Changes (by clescuyer):

 * keywords:  needs-patch => has-patch needs-testing


Comment:

 A very similar issue happens with tags. To replicate:

 - Create a post tag named "0" (just the number without quotes).
 - Add this tag to a few posts
 - Go to WP-Admin > Tags and the "Count" column in the "0" row will display
 the number of posts with this tag. Click on this number.

 Now instead of displaying posts with the category "0", no posts are
 displayed.

 For the categories, I used the `array_filter()` with the callback @jesin
 suggested. For the tags I suggest an enhanced test instead of `! empty(
 $q[ $t->query_var ] )`.


 ''Issue analyzed and solved during WordCamp Paris 2019 Contributor day.''

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


More information about the wp-trac mailing list