Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#58412 closed enhancement (wontfix)

Allowing rand orderby value for post query params

Reported by: vrishabhsk's profile vrishabhsk Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: dev-feedback has-patch
Focuses: performance Cc:

Description

I need to add 'rand' in the enums of the $query_params of 'orderby' key In order to implement this feature - https://github.com/WordPress/gutenberg/issues/40481 in Gutenberg.

Change History (3)

This ticket was mentioned in PR #4513 on WordPress/wordpress-develop by Vrishabhsk.


11 months ago
#1

  • Keywords has-patch added

#2 @TimothyBlynJacobs
11 months ago

  • Focuses performance added; rest-api removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Version changed from trunk to 4.7

Hi @vrishabhsk,

Thanks for the ticket and welcome to trac!

The REST API intentionally does not support orderby of rand due to performance issues and it breaks caching guarantees, see #38693.

The REST API is very extensible, so plugins can easily add support for it if they'd like to: https://felipeelia.dev/wordpress-rest-api-enable-random-order-of-posts-list/

#3 @galbaras
11 months ago

I think this decision may be overstepping. Let site owners decide what's good for their sites' performance. If it sucks, they'll use something else, but if it's important, it should be there.

Note: See TracTickets for help on using tickets.