Changeset 21953 for trunk/wp-includes/post.php
- Timestamp:
- 09/22/2012 04:21:06 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r21952 r21953 558 558 $post = get_post( $post ); 559 559 560 $ancestors = array(); 561 562 if ( !empty( $post->post_parent ) && $post->ID != $post->post_parent ) { 563 $id = $ancestors[] = $post->post_parent; 564 565 while ( $ancestor = get_post( $id ) ) { 566 // Loop detection: If the ancestor has been seen before, break. 567 if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) ) 568 break; 569 570 $id = $ancestors[] = $ancestor->post_parent; 571 } 572 } 560 if ( empty( $post->post_parent ) || $post->post_parent == $post->ID ) 561 return array(); 562 563 $ancestors = array(); 564 565 $id = $ancestors[] = $post->post_parent; 566 567 while ( $ancestor = get_post( $id ) ) { 568 // Loop detection: If the ancestor has been seen before, break. 569 if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) ) 570 break; 571 572 $id = $ancestors[] = $ancestor->post_parent; 573 } 573 574 574 575 return $ancestors;
Note: See TracChangeset
for help on using the changeset viewer.