Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#16844 closed defect (bug)

WP_Query::get_posts() pollutes the 'orderby' query var — at Version 1

Reported by: scribu Owned by:
Milestone: 3.2 Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: Cc:

Description (last modified by scribu)

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'] )

Change History (2)

7 years ago

#1 @scribu
7 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.