[wp-trac] [WordPress Trac] #35692: Allow seed value to be passed to WP_Query when using random ordering
WordPress Trac
noreply at wordpress.org
Sat Feb 20 04:15:13 UTC 2016
#35692: Allow seed value to be passed to WP_Query when using random ordering
-------------------------------------------------+-------------------------
Reporter: hlashbrooke | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
Component: Query | Review
Severity: normal | Version: trunk
Keywords: has-patch needs-unit-tests 2nd- | Resolution:
opinion | Focuses:
-------------------------------------------------+-------------------------
Comment (by boonebgorges):
> The part that would be a bit more complex is that the orderby parameter
is validated against a list of allowed options and if we allowed that to
have a value of rand(3) then it would mean that the validation there would
need to be modified quite heavily.
Yeah, it would require some modification. See [attachment:35692.2.diff]
for an idea. It's not very elegant, but it gets the job done. Personally,
while I think the internal logic here is not beautiful, I think `'orderby'
=> 'RAND(5)'` is a pretty good syntax for devs.
> Do you perhaps have a better parameter name than seed if we were to
continue to use that as a separate parameter?
At the very least, the name should make it clear that it's connected to
`RAND`. Maybe `orderby_rand_seed`?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35692#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list