Skip to content

Instantly share code, notes, and snippets.

@maor
Created September 14, 2012 10:26
Show Gist options
  • Save maor/3721197 to your computer and use it in GitHub Desktop.
Save maor/3721197 to your computer and use it in GitHub Desktop.
add_action( 'pre_get_posts', 'mc_modify_query_rand_posts' );
function mc_modify_query_rand_posts( $query ) {
if ( ! is_admin() && $query->is_main_query() )
$query->set( 'orderby', 'rand' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment