[wp-trac] [WordPress Trac] #47642: Order by comment count - posts list tables

WordPress Trac noreply at wordpress.org
Fri Sep 26 05:03:53 UTC 2025


#47642: Order by comment count - posts list tables
-------------------------------------------------+-------------------------
 Reporter:  alektabor                            |       Owner:
                                                 |  johnbillion
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Posts, Post Types                    |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-screenshots has-patch early      |     Focuses:
  early-like-actually-early has-unit-tests       |  administration
-------------------------------------------------+-------------------------

Comment (by ramonopoly):

 This bug came up when I was trying to filter attachment posts by
 `media_type`

 https://core.trac.wordpress.org/ticket/64042

 My workaround was, when multiple attachments have the same post_date, to
 add ID as secondary sort to guarantee consistent ordering.



 {{{
                                 $query_args['orderby'] = array(
                                         'date' => $query_args['order'] ??
 'DESC',
                                         'ID'   => 'DESC',
                                 );
 }}}


 Similar to what #52907 proposes and what I think @ramon-fincken does with
 the latest patch?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47642#comment:52>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list