[wp-trac] [WordPress Trac] #38839: wp_list_categories can output not well nested HTML

WordPress Trac noreply at wordpress.org
Thu Nov 17 16:23:17 UTC 2016


#38839: wp_list_categories can output not well nested HTML
--------------------------+-----------------------------
 Reporter:  chesio        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi,

 #33460 requested an option to hide title if no categories are present.
 This has been implemented in [33764] and [33767].

 However, [33764] introduced a bug that can result in not well nested
 output, because only the condition that optionally "opens" list item and
 starts new list has been altered, not the condition that optionally close
 both.

 On a clean install (from trunk):
 {{{#!php
 wp_list_categories([
         'child_of' => 1, // to have $categories empty
         'hide_title_if_empty' => true, // to hide title
         'show_option_none' => '', // to get only the invalid output
 ]);
 }}}

 Produces:
 {{{
 </ul></li>
 }}}

 I believe, the fix is quite straight-forward - see the patch attached.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38839>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list