WP Admin custom post list page blank

When i was working with wp e-commerce plugin, i saw product list page is blank. After taking a deeper look i found, WordPress Post List Table Classs loads all the posts at once while post type is hierarchical and there has been no orderby argument. You can check the reference on wp-admin/includes/post.php file on function wp_edit_posts_query. So, if the memory is low and the post amount is to much high, the page will be blank.

To get rid of this, you can place the code on any active plugin or in your themes function.php file.

add_action( 'load-edit.php', 'fix_hierarchical_post_list' );
function fix_hierarchical_post_list(){
	if( isset($_REQUEST['post_type']) && !isset($_REQUEST['orderby']) ){
		$post_type = $_REQUEST['post_type'];
		if( isset($GLOBALS['wp_post_types'][$post_type]) ){
			$GLOBALS['wp_post_types'][$post_type]->hierarchical = false;
		}
	}
}

So here, we are only declaring the current post type to non hierarchical on its list page only.

Hope that helps.

Discussion