[wp-trac] Re: [WordPress Trac] #8958: Huge amount rewrite rules for page revisions after upgrade

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 19 16:38:30 GMT 2009


#8958: Huge amount rewrite rules for page revisions after upgrade
--------------------------+-------------------------------------------------
 Reporter:  matthijs      |       Owner:  ryan                    
     Type:  defect (bug)  |      Status:  new                     
 Priority:  normal        |   Milestone:  2.8                     
Component:  Permalinks    |     Version:  2.7                     
 Severity:  major         |    Keywords:  needs-patch dev-feedback
--------------------------+-------------------------------------------------
Changes (by Denis-de-Bernardy):

  * keywords:  permalinks, rewrite_rules, revisions needs-patch => needs-
               patch dev-feedback


Comment:

 couldn't this:

 {{{
 $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name,
 post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND
 post_parent = %d", $id ));
 }}}

 be replaced, by code that looks something this before the foreach loop:

 {{{
 $all_attachments = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE
 post_type = 'attachment');
 update_post_caches($all_attachments);
 }}}

 and then in the foreach loop:

 {{{
 $attachments = get_children(...)
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/8958#comment:9>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list