[wp-trac] [WordPress Trac] #26987: Bug in wp_list_pages(), caused by start_lvl()

WordPress Trac noreply at wordpress.org
Sat Feb 1 21:47:55 UTC 2014


#26987: Bug in wp_list_pages(), caused by start_lvl()
--------------------------+-----------------------------
 Reporter:  awelzel       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 start_lvl() in wp-includes/post-template.php adds a new line for the next
 level in the page list.

 {{{
         function start_lvl( &$output, $depth = 0, $args = array() ) {
                 $indent = str_repeat("\t", $depth);
                 $output .= "\n$indent<ul class='children'>\n";
         }
 }}}

 This causes an </p> to be inserted in the page list generated by
 wp_list_pages() because something in the core assumes the new line to be
 the end of a paragraph.

 Example: See <http://arnowelzel.de/wp/sitemap>

 Possible bug fix: Just remove the newline.

 {{{
         function start_lvl( &$output, $depth = 0, $args = array() ) {
                 $indent = str_repeat("\t", $depth);
                 $output .= "$indent<ul class='children'>\n";
         }
 }}}

 As suggested in the nearly two year old(!) forum post:

 http://wordpress.org/support/topic/wp_list_pages-creates-extra-paragraph-
 only-on-first-child

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


More information about the wp-trac mailing list