[wp-trac] [WordPress Trac] #36314: If orderby undefined, alter get_posts to defer to WP_Query's default
WordPress Trac
noreply at wordpress.org
Sat Aug 30 23:22:31 UTC 2025
#36314: If orderby undefined, alter get_posts to defer to WP_Query's default
-------------------------------+-----------------------
Reporter: peterwilsoncc | Owner: (none)
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Posts, Post Types | Version:
Severity: normal | Resolution: wontfix
Keywords: reporter-feedback | Focuses: template
-------------------------------+-----------------------
Changes (by peterwilsoncc):
* status: new => closed
* resolution: => wontfix
Comment:
@SirLouen Gosh, I opened this a while ago...
For search queries, the default sort order is by relevance, see
[https://github.com/WordPress/wordpress-
develop/blob/8938a326244e3fb1e27e0f64413f72fffe8467b1/src/wp-includes
/class-wp-query.php#L2546-L2568 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36314#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list