Make WordPress Core

Opened 10 years ago

Closed 7 months ago

#36314 closed enhancement (wontfix)

If orderby undefined, alter get_posts to defer to WP_Query's default

Reported by: peterwilsoncc's profile peterwilsoncc Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: reporter-feedback
Focuses: template Cc:

Description

If the argument is undefined, defer get_posts orderby & order to that of WP_Query's.

For search strings, this will order posts by relevance. In other cases it will have no effect.

Change History (4)

#1 @peterwilsoncc
10 years ago

  • Summary changed from If orderby undefined, get_posts should defer to WP_Query's default to If orderby undefined, alter get_posts to defer to WP_Query's default

#2 @peterwilsoncc
10 years ago

  • Keywords needs-patch needs-unit-tests added

#3 @SirLouen
7 months ago

  • Keywords reporter-feedback added; needs-patch needs-unit-tests removed

@peterwilsoncc afaik, currently it orders by descending date by default unconditionally.

Can you elaborate on the reasoning behind this enhancement proposal, for documentation purposes and if someone looks back into the history of changes, understands how we got to this conclusion?

It has not had any traction for one decade, so it seems this doesn't seem too demanded or maybe is not required any more. Personally, I cannot figure out your intentions here.

#4 @peterwilsoncc
7 months ago

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

@SirLouen Gosh, I opened this a while ago...

For search queries, the default sort order is by relevance, see WP_Query code reference, rather than by date.

My intent was to use that for get_posts( ['s' => 'search term' ] );.

It has not had any traction for one decade, so it seems this doesn't seem too demanded.

I agree, I'll close this as wontfix.

Note: See TracTickets for help on using tickets.