Make WordPress Core

Ticket #15915: 15915.2.diff

File 15915.2.diff, 1.1 KB (added by greuben, 14 years ago)
  • wp-includes/rewrite.php

     
    767767                global $wpdb;
    768768
    769769                //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 );
    771772
    772773                // If we have no pages get out quick
    773774                if ( !$posts )
     
    781782
    782783                foreach ( $posts as $id => $post ) {
    783784                        // URL => page name
    784                         $uri = get_page_uri($id);
     785                        $uri = get_page_uri($_posts[$id]);
    785786                        $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id ));
    786787                        if ( !empty($attachments) ) {
    787788                                foreach ( $attachments as $attachment ) {