Make WordPress Core

Ticket #47642: patch.47642.20190923.1

File patch.47642.20190923.1, 766 bytes (added by ramon fincken, 7 years ago)

patch.47642.20190923.1

Line 
1Index: src/wp-admin/includes/post.php
2===================================================================
3--- src/wp-admin/includes/post.php (revision 46194)
4+++ src/wp-admin/includes/post.php (working copy)
5@@ -1180,6 +1180,13 @@
6 $query['fields'] = 'id=>parent';
7 }
8
9+ // Database fix where paginated resultsets in wp-admin CPT table listing with only orderby = comment_count
10+ // have the very same subset of results troughout the pagination. Add any other field to the orderby.
11+ // Ticket #47642
12+ if( $orderby == 'comment_count' && $posts_per_page > 0 ) {
13+ $query['orderby'] = array( $orderby => $order, 'ID' => $order );
14+ }
15+
16 if ( ! empty( $q['show_sticky'] ) ) {
17 $query['post__in'] = (array) get_option( 'sticky_posts' );
18 }