﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
4617,Allow random post ordering,Otto42,ryan,"This change is to allow orderby=rand for all the post query functions.

Changes needed:
In wp-includes, query.php, add ""rand"" to the list of $allowed_keys.

Modify this code
{{{
if ( 'menu_order' != $orderby )
$orderby = 'post_' . $orderby;
}}}

into this:
{{{
if ( 'menu_order' != $orderby && 'rand' != $orderby)
$orderby = 'post_' . $orderby;
if ('rand' == $orderby)
$orderby = 'RAND()';`
}}}

This will allow the mysql ""ORDER BY RAND()"" to be used in querying posts. There are lots of potential uses for pulling random posts, and current plugins to do it always have to directly query the database for them, meaning that they break whenever the database structure changes. Providing this sort of functionality directly makes more sense.

Since this is a simple change that doesn't break anything and only adds minor functionality, I suggest getting it in quickly. Preferably trunk. I would submit a patch, but I can't right now and anyway it's a simple change.
",enhancement,closed,normal,2.5,Template,2.2.1,normal,fixed,has-patch,xurizaemon@…
