Changeset 20171 for trunk/wp-includes/post.php
- Timestamp:
- 03/12/2012 06:23:48 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r20156 r20171 431 431 $post = get_post($post); 432 432 433 if ( !empty($post->ancestors) ) 433 if ( ! isset( $post->ancestors ) ) 434 _get_post_ancestors( $post ); 435 436 if ( ! empty( $post->ancestors ) ) 434 437 return $post->ancestors; 435 438 … … 4646 4649 return; 4647 4650 4648 $id = $_post->ancestors[] = $_post->post_parent;4651 $id = $_post->ancestors[] = (int) $_post->post_parent; 4649 4652 while ( $ancestor = $wpdb->get_var( $wpdb->prepare("SELECT `post_parent` FROM $wpdb->posts WHERE ID = %d LIMIT 1", $id) ) ) { 4650 4653 // Loop detection: If the ancestor has been seen before, break. 4651 4654 if ( ( $ancestor == $_post->ID ) || in_array($ancestor, $_post->ancestors) ) 4652 4655 break; 4653 $id = $_post->ancestors[] = $ancestor;4656 $id = $_post->ancestors[] = (int) $ancestor; 4654 4657 } 4655 4658 }
Note: See TracChangeset
for help on using the changeset viewer.