[wp-trac] [WordPress Trac] #41350: Support for random order in WP_Term_Query::query()

WordPress Trac noreply at wordpress.org
Tue Aug 1 00:29:31 UTC 2017


#41350: Support for random order in WP_Term_Query::query()
--------------------------------------+------------------------------
 Reporter:  camthor                   |       Owner:
     Type:  feature request           |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Taxonomy                  |     Version:  4.8
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+------------------------------
Changes (by bretterer):

 * keywords:  good-first-bug needs-patch => good-first-bug has-patch


Comment:

 Hello,

 I took a stab at this ticket.  I believe this covers the case stated in
 the ticket for allowing `"orderby" => "rand"`  to be  added to a new
 term_query.

 I went one step further and now allow `rand`, `random`, or `rand()` to be
 passed into the `orderby` property.  If any of these are passed, the query
 will change the `ORDER BY` from `name` to `rand()`

 Tests have been written as well to test for each of these properties.

 Please let me know if this is correct.

 -Brian

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41350#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list