• Can’t for the life of me get the orderby to be random in this wp_query. ‘rand’ not working at all.

    Can anyone see why this code is still producing a list of posts in standard reverse chronological order instead of randomized mix?

    function homex_top10_loop() {
    	$args = array(
    		'posts_per_page' => 10,
    		'post_type' => 'post',
    		'cat' => 4,
    		'orderby' => 'rand'
    	);
    	//print_r($args);
    	global $wp_query;
    	$wp_query = new WP_Query( $args );
Viewing 16 replies (of 16 total)
Viewing 16 replies (of 16 total)

The topic ‘wp_query orderby random not working’ is closed to new replies.