WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#16844 closed defect (bug)

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

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'] ) && 'some_value' == $wp_query->query['orderby'] )

Change History (3)

@scribu4 years ago

comment:1 @scribu4 years ago

  • Description modified (diff)

comment:2 @scribu4 years ago

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