Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#12239 closed defect (bug) (worksforme)

orderby and stiky post won't work as expected

Reported by: lifeless85 Owned by:
Milestone: Priority: high
Severity: major Version: 2.9.1
Component: General Keywords: orderby, stiky, Wp_query
Focuses: Cc:


i've discovered that if i use orderby parameter in my Wp_query, stiky posts don't get on top, i was expecting that they remain on top and sorted too by the parameter i've decided because i was not passing caller_get_posts.

for example this fits to:




by now the simplest way we have to do this is to do two custom loop and count the outputted posts like this:

	'post__in' => $sticky,
	'caller_get_posts' => 1,
//do the loop here
	'post__not_in' => $sticky,
	'caller_get_posts' => 1,
//do the second loop here

Notice that if we want 2 post we need to count how much have been outputted or they will be 4.

I've marked priority high because if people starts to use this features massively probabily fixing it in the future, would break backward compatibility for future versions.

Change History (4)

comment:1 @layotte5 years ago

I am unable to duplicate this using Trunk & 2010 theme (as of 04/24/2010)...

comment:2 @ryan5 years ago

  • Milestone changed from 3.0 to Future Release

comment:3 @simonwheatley5 years ago

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

I can't replicate the issue with the first query_posts example given. There is a typo in the second query_posts (missing & before orderby), the ordering of resulting posts from the typo'd version is a bit weird but I cannot replicate it with the corrected query_posts. Was testing using TwentyTen.

Recommend closing.

comment:4 @nacin5 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.