#21875 closed enhancement (wontfix)
get_categories orderby random
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | trivial | Version: | 3.4.2 |
| Component: | Taxonomy | Keywords: | |
| Focuses: | Cc: |
Description
There's no option to order the categories in the get_categories function by random..
Maybe you can include it in the next version.
get_posts etc. has got this option.
Change History (4)
#1
@
13 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
#2
follow-up:
↓ 3
@
13 years ago
Have used the shuffle function, but think, that my way brings a better performance..
#3
in reply to:
↑ 2
@
13 years ago
Replying to Ninos Ego:
Have used the shuffle function, but think, that my way brings a better performance..
When you push randomization to SQL, it means we can't actually cache the results, as they're supposed to be random. get_posts() does pagination, which is why we push it to SQL — you need only X of Y posts, but a random X of them.
But get_terms(), as scribu said, isn't paginated. Thus, letting the query be cached, then shuffling them on your own, makes more sense.
Note: See
TracTickets for help on using
tickets.
Unlike get_posts(), get_categories() doesn't have pagination, so you can just use shuffle():