Ticket #16574: 16574.2.diff
File 16574.2.diff, 863 bytes (added by , 13 years ago) |
---|
-
post.php
4582 4582 return; 4583 4583 4584 4584 $id = $_post->ancestors[] = $_post->post_parent; 4585 while ( $ancestor = $wpdb->get_var( $wpdb->prepare("SELECT `post_parent` FROM $wpdb->posts WHERE ID = %d LIMIT 1", $id) ) ) { 4585 4586 while ( $ancestor = get_posts( array( 'post_parent' => $id, 'post_type' => 'any', 'numberposts' => 1, 'update_post_meta_cache' => false, 'update_post_term_cache' => false ) ) ) { 4586 4587 // Loop detection: If the ancestor has been seen before, break. 4587 if ( ( $ancestor == $_post->ID ) || in_array($ancestor, $_post->ancestors) )4588 if ( ( $ancestor[0]->ID == $_post->ID ) || in_array($ancestor[0]->ID, $_post->ancestors) ) 4588 4589 break; 4589 $id = $_post->ancestors[] = $ancestor ;4590 $id = $_post->ancestors[] = $ancestor[0]->ID; 4590 4591 } 4591 4592 } 4592 4593