-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Latest Posts] Add Order items by: random #23524
Comments
Hi @marceloaof ! That's a nice idea to implement to |
Needs to change here: https://github.com/WordPress/WordPress/blob/71244fc29e1ab7117383f17bab8f47db91814087/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php#L2641 and add |
It's odd that WP_REST_Posts_Controller's param collection doesn't honour WP_Query's parameters. @marceloaof, this might be something to ask the REST API team β is it oversight, is it an intentional omission? |
|
I'll close this issue for now due to the performance issues that |
What would you recommend using instead of It wouldn't even be a problem if there were way to even just filter the query that happens. Then we could just set the |
This is not a query that is WP specific but is related to most databases and without using a cache mechanism and with a possible large number of posts this can be indeed an intensive operation. IMO many users do not have the technical knowledge of such an impact and/or what even Having said that, as you can see from @mcsf and my above comments I agree with you that WP_Query's parameters should be supported and I'd really love if you could raise that again in the existing trac ticket: https://core.trac.wordpress.org/ticket/38693 or even create a new one to be discussed again. |
As mentioned above, this is not a WordPress issue but a database/MySQL issue. |
Allow it to be filterable then? |
It would be safer to just build this as a separate block in a plugin if your site needs random order. Adding |
This is already filterable using |
Hello! ππ Currently we can:
It would be good to have the ability to sort/order Posts randomly on the Latest Posts block. Currently, ordering is dualistic, which always disregards some posts in favor of others. When post dates or post titles are not relevant for establishing the order of equally important posts, the randomic sorting/ordering is necessary.
It improves the following scenarios: Category with important, timeless posts. Related Posts. Testimonial Posts.
I offer a mockup of the proposed solution:
The text was updated successfully, but these errors were encountered: