[wp-trac] [WordPress Trac] #2333: Controlling sort order with WP_rewrite in 2.0.x

WordPress Trac noreply at wordpress.org
Wed Nov 12 09:40:31 UTC 2025


#2333: Controlling sort order with WP_rewrite in 2.0.x
--------------------------+----------------------
 Reporter:  stewart@…     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  2.0
 Severity:  normal        |  Resolution:  invalid
 Keywords:  rewrite       |     Focuses:
--------------------------+----------------------

Comment (by mariaungureanu79):

 By hooking onto posts_orderby:

 {{{#!php
 <?php
 function force_desc($orderby) {
   $orderby = preg_replace('/ORDER BY ([^ ]+?) (ASC|DESC)?/', 'ORDER BY
 $1', $orderby);
   return $orderby
 }
 }}}

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


More information about the wp-trac mailing list