| 1 | Index: wp-includes/rewrite.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/rewrite.php (revision 18407) |
|---|
| 4 | +++ wp-includes/rewrite.php (working copy) |
|---|
| 5 | @@ -767,7 +767,8 @@ |
|---|
| 6 | global $wpdb; |
|---|
| 7 | |
|---|
| 8 | //get pages in order of hierarchy, i.e. children after parents |
|---|
| 9 | - $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'") ); |
|---|
| 10 | + $_posts = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status != 'auto-draft'", OBJECT_K); |
|---|
| 11 | + $posts = get_page_hierarchy( $_posts ); |
|---|
| 12 | |
|---|
| 13 | // If we have no pages get out quick |
|---|
| 14 | if ( !$posts ) |
|---|
| 15 | @@ -781,7 +782,7 @@ |
|---|
| 16 | |
|---|
| 17 | foreach ( $posts as $id => $post ) { |
|---|
| 18 | // URL => page name |
|---|
| 19 | - $uri = get_page_uri($id); |
|---|
| 20 | + $uri = get_page_uri($_posts[$id]); |
|---|
| 21 | $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id )); |
|---|
| 22 | if ( !empty($attachments) ) { |
|---|
| 23 | foreach ( $attachments as $attachment ) { |
|---|