Changeset 6351 for trunk/wp-includes/post.php
- Timestamp:
- 12/04/2007 12:19:10 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r6337 r6351 1169 1169 } 1170 1170 1171 function generate_page_uri_index() {1172 global $wpdb;1173 1174 //get pages in order of hierarchy, i.e. children after parents1175 $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'"));1176 //now reverse it, because we need parents after children for rewrite rules to work properly1177 $posts = array_reverse($posts, true);1178 1179 $page_uris = array();1180 $page_attachment_uris = array();1181 1182 if ($posts) {1183 1184 foreach ($posts as $id => $post) {1185 1186 // URL => page name1187 $uri = get_page_uri($id);1188 $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id ));1189 if ( $attachments ) {1190 foreach ( $attachments as $attachment ) {1191 $attach_uri = get_page_uri($attachment->ID);1192 $page_attachment_uris[$attach_uri] = $attachment->ID;1193 }1194 }1195 1196 $page_uris[$uri] = $id;1197 }1198 1199 delete_option('page_uris');1200 update_option('page_uris', $page_uris);1201 1202 if ( $page_attachment_uris ) {1203 delete_option('page_attachment_uris');1204 update_option('page_attachment_uris', $page_attachment_uris);1205 }1206 }1207 }1208 1209 1171 // 1210 1172 // Attachment functions
Note: See TracChangeset
for help on using the changeset viewer.