Ticket #15915: 15915.2.diff
File 15915.2.diff, 1.1 KB (added by , 14 years ago) |
---|
-
wp-includes/rewrite.php
767 767 global $wpdb; 768 768 769 769 //get pages in order of hierarchy, i.e. children after parents 770 $posts = get_page_hierarchy( $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status != 'auto-draft'") ); 770 $_posts = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status != 'auto-draft'", OBJECT_K); 771 $posts = get_page_hierarchy( $_posts ); 771 772 772 773 // If we have no pages get out quick 773 774 if ( !$posts ) … … 781 782 782 783 foreach ( $posts as $id => $post ) { 783 784 // URL => page name 784 $uri = get_page_uri($ id);785 $uri = get_page_uri($_posts[$id]); 785 786 $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id )); 786 787 if ( !empty($attachments) ) { 787 788 foreach ( $attachments as $attachment ) {