Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#16844 closed defect (bug) (fixed)

WP_Query::get_posts() pollutes the 'orderby' query var

Reported by: scribu's profile 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'] )

Attachments (1)

16844.diff (1.9 KB) - added by scribu 13 years ago.

Download all attachments as: .zip

Change History (5)

13 years ago

#1 @scribu
13 years ago

  • Description modified (diff)

#2 @scribu
13 years ago

  • Description modified (diff)

#3 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.2

#4 @ryan
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [17653]) Don't pollute orderby query var. Props scribu. fixes #16844

Note: See TracTickets for help on using tickets.