Ticket #43842: 43842.diff
File 43842.diff, 1.9 KB (added by , 7 years ago) |
---|
-
src/wp-includes/post.php
526 526 function get_children( $args = '', $output = OBJECT ) { 527 527 $kids = array(); 528 528 if ( empty( $args ) ) { 529 if ( isset( $GLOBALS['post'] ) ) { 530 $args = array( 'post_parent' => (int) $GLOBALS['post']->post_parent ); 531 } else { 529 if ( ! isset( $GLOBALS['post'] ) ) { 532 530 return $kids; 533 531 } 532 $args['post_parent'] = (int) $GLOBALS['post']->post_parent; 534 533 } elseif ( is_object( $args ) ) { 535 $args = array( 'post_parent' => (int) $args->post_parent );534 $args['post_parent'] = (int) $args->post_parent; 536 535 } elseif ( is_numeric( $args ) ) { 537 $args = array( 'post_parent' => (int) $args );536 $args['post_parent'] = (int) $args; 538 537 } 539 538 540 539 $defaults = array( … … 562 561 $kids[ $child->ID ] = $children[ $key ]; 563 562 } 564 563 565 if ( $output == OBJECT ) { 566 return $kids; 567 } elseif ( $output == ARRAY_A ) { 568 $weeuns = array(); 569 foreach ( (array) $kids as $kid ) { 570 $weeuns[ $kid->ID ] = get_object_vars( $kids[ $kid->ID ] ); 571 } 572 return $weeuns; 573 } elseif ( $output == ARRAY_N ) { 574 $babes = array(); 575 foreach ( (array) $kids as $kid ) { 576 $babes[ $kid->ID ] = array_values( get_object_vars( $kids[ $kid->ID ] ) ); 577 } 578 return $babes; 579 } else { 580 return $kids; 564 switch ( $output ) { 565 case OBJECT: 566 return $kids; 567 break; 568 case ARRAY_A: 569 $weeuns = array(); 570 foreach ( (array) $kids as $kid ) { 571 $weeuns[ $kid->ID ] = get_object_vars( $kids[ $kid->ID ] ); 572 } 573 return $weeuns; 574 break; 575 case ARRAY_N: 576 $babies = array(); 577 foreach ( (array) $kids as $kid ) { 578 $babies[ $kid->ID ] = array_values( get_object_vars( $kids[ $kid->ID ] ) ); 579 } 580 return $babies; 581 break; 582 default: 583 return $kids; 584 break; 581 585 } 582 586 } 583 587