Changeset 51204
- Timestamp:
- 06/22/2021 07:07:26 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-walker.php
r49509 r51204 343 343 $children_elements = array(); 344 344 foreach ( $elements as $e ) { 345 if ( 0 == $e->$parent_field) {345 if ( empty( $e->$parent_field ) ) { 346 346 $top_level_elements[] = $e; 347 347 } else { … … 413 413 414 414 foreach ( $elements as $e ) { 415 if ( 0 == $e->$parent_field) {415 if ( empty( $e->$parent_field ) ) { 416 416 $num++; 417 417 } -
trunk/tests/phpunit/tests/walker.php
r50449 r51204 281 281 } 282 282 283 /** 284 * @ticket 53474 285 */ 286 function test_multiple_items_non_numeric_parent() { 287 288 $items = array( 289 (object) array( 290 'id' => 1, 291 'parent' => '', 292 ), 293 (object) array( 294 'id' => 2, 295 'parent' => '', 296 ), 297 ); 298 $output = $this->walker->walk( $items, 0 ); 299 300 $this->assertSame( 2, $this->walker->get_number_of_root_elements( $items ) ); 301 $this->assertSame( '<li>1</li><li>2</li>', $output ); 302 303 $output = $this->walker->paged_walk( $items, 0, 1, 1 ); 304 305 $this->assertSame( '<li>1</li>', $output ); 306 307 $output = $this->walker->paged_walk( $items, 0, 2, 1 ); 308 309 $this->assertSame( '<li>2</li>', $output ); 310 311 } 312 283 313 } 284 314
Note: See TracChangeset
for help on using the changeset viewer.