[wp-trac] [WordPress Trac] #55834: wp_list_categories not working correctly since 6.0 upgrade

WordPress Trac noreply at wordpress.org
Thu May 26 01:45:56 UTC 2022


#55834: wp_list_categories not working correctly since 6.0 upgrade
-------------------------------+------------------------------
 Reporter:  ericcorbett2       |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Taxonomy           |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by peterwilsoncc):

 * keywords:   => reporter-feedback
 * component:  General => Taxonomy


Comment:

 Hi @ericcorbett2 and welcome to trac!

 I have tried to reproduce this problem but am unable to I am afraid.

 `wp_list_categories( ['child_of' => 2] );` is showing the category I have
 set up as a subcategory of category `2`:

 {{{#!htm
 <!-- reformatted for clarity -->

 <li class="categories">
         Categories
         <ul>
                 <li class="cat-item cat-item-3">
                         <a href="http://wp-dev.local/category/categorized
 /sub-categorized/">Sub-categorized</a>
                 </li>
         </ul>
 </li>
 }}}

 By default `wp_list_categories()` will hide categories that do not contain
 any posts unless you include the argument `'hide_empty' => false`.

 Are you able to confirm your child categories have posts or you have
 included above?

 ----

 **Testing notes**

 Created two categories
 * `Categorized` (given the id `2`, no parent)
 * `Sub-categorized` (given the ID `2`, `categorized` as parent)

 Ran the following code
 * `wp_list_categories( ['child_of' => 2] )` -- no categories display due
 to lack of posts
 * `wp_list_categories( ['child_of' => 2, 'hide_empty' => false] );` --
 `Sub-categorized` shown as expected

 Created a post and assigned it to `sub-categorized` and re-ran the
 following code
 * `wp_list_categories( ['child_of' => 2] )` -- `Sub-categorized` shown as
 expected
 * `wp_list_categories( ['child_of' => 2, 'hide_empty' => false] );` --
 `Sub-categorized` shown as expected

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


More information about the wp-trac mailing list