WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/04/2007 12:19:10 AM (12 years ago)
Author:
ryan
Message:

Don't save page and attachemtn uris to page_uris and page_attachment_uris. This is not needed. Add an option to use wildcard page rewrite rules instead of per-page rules. see #3614

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r6337 r6351  
    11691169}
    11701170
    1171 function generate_page_uri_index() {
    1172     global $wpdb;
    1173 
    1174     //get pages in order of hierarchy, i.e. children after parents
    1175     $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 properly
    1177     $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 name
    1187             $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 
    12091171//
    12101172// Attachment functions
Note: See TracChangeset for help on using the changeset viewer.