[wp-trac] [WordPress Trac] #26326: wp_edit_posts_query() loads all the posts into memory for hierarchical post types causing memory exhaustion

WordPress Trac noreply at wordpress.org
Fri Nov 29 19:31:31 UTC 2013


#26326: wp_edit_posts_query() loads all the posts into memory for hierarchical post
types causing memory exhaustion
---------------------------+-----------------------------
 Reporter:  rodrigosprimo  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Post Types     |    Version:
 Severity:  normal         |   Keywords:
---------------------------+-----------------------------
 wp_edit_posts_query() loads all posts and post metas into memory for
 hierarchical post types when only a few are actually used to generated the
 admin page that lists them (wp-admin/edit.php).

 I run a site with 4000 hierarchical posts of a custom type but this number
 is growing. Each post has about 10 small post metas. It is not possible to
 load the wp-admin/edit.php for this post type on the production server
 because of a memory exhausted error. On the development server I was able
 to check that the peak memory usage for this page is 321MB.

 This problem is related with the code below from wp_edit_posts_query():

 {{{
         // Hierarchical types require special args.
         if ( is_post_type_hierarchical( $post_type ) && !isset($orderby) )
 {
                 $query['orderby'] = 'menu_order title';
                 $query['order'] = 'asc';
                 $query['posts_per_page'] = -1;
                 $query['posts_per_archive_page'] = -1;
         }
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26326>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list