[wp-trac] [WordPress Trac] #16844: WP_Query::get_posts() pollutes the 'orderby' query var

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 13 07:34:27 UTC 2011


#16844: WP_Query::get_posts() pollutes the 'orderby' query var
--------------------------+-----------------------------
 Reporter:  scribu        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 After running through get_posts(), the 'orderby' query var no longer
 contains the original value, but the final SQL code.

 Thus, instead of:

 {{{
 if ('some_value' == $wp_query->get( 'orderby' ) ) {
 }}}

 you have to do:

 {{{
 if ( isset( $wp_query->query['orderby'] ) && 'qa_score' ==
 $wp_query->query['orderby'] ) {
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16844>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list