Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29919 closed defect (bug) (duplicate)

Admin posts overview (edit.php) for hierarchical custom post type loads all posts

Reported by: engelen's profile engelen Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Posts, Post Types Keywords:
Focuses: administration, performance Cc:


It seems as though the admin posts overview for hierarchical post types loads all available posts for the post type through WP_Query. Backtracing from WP_Posts_List_Table::prepare_items leads to wp_edit_posts_query in wp-admin/includes/post.php, which has at the end of the function.

	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;

It stems from the original edit-pages.php file, which was merged in 2010 (

So, basically, for hierarchical post types, the posts overview loads all posts from the database (or from cache). Has this ever come up before in Trac ([it has in forums]( It seems incredibly inefficient and could possibly slow down (or bring down) servers.

Change History (1)

#1 @SergeyBiryukov
10 years ago

  • Component changed from Administration to Posts, Post Types
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #15459.

Note: See TracTickets for help on using tickets.