[wp-trac] [WordPress Trac] #61749: `wp_list_pages()` depth of `0` can show only top level of pages

WordPress Trac noreply at wordpress.org
Thu Jul 25 06:00:20 UTC 2024


#61749: `wp_list_pages()` depth of `0` can show only top level of pages
---------------------------+--------------------
 Reporter:  peterwilsoncc  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  6.6.2
Component:  General        |    Version:  6.6
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+--------------------
 In WP 6.6, the code `wp_list_pages( 'depth=0' );` no longer displays a
 list of all pages to the maximum depth. Instead only the top level of
 pages will be displayed.

 Steps to reproduce:

 1. Replace entire theme with `wp_list_pages( 'depth=0' );`
 2. Create a few pages with parent child relationships
 3. On the latest version of 6.5 a heirachical list of pages will be
 displayed
 4. On the 6.6 branch and in trunk the top level pages will only be shown.

 The cause is r57848 as the switch to strict comparisons in the walker
 class does not account for the way `wp_parse_args()` handles query string
 formatted arguments passed to the function and therefore interpreted,
 eventually, by the walker:


 {{{
 wp> wp_parse_args( 'depth=0', [ 'depth' => 0 ] );
 => phar:///usr/local/src/wp-cli/bin/wp/vendor/wp-cli/shell-
 command/src/WP_CLI/Shell/REPL.php:52:
 array(1) {
   'depth' =>
   string(1) "0"
 }
 wp>
 }}}

 I expect this is effecting other functions that make use of the walker
 class too.

 ----

 Props @ahortin via the WP Australia Slack for discovery and assistance
 figuring out reproduction steps.

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


More information about the wp-trac mailing list