I’ve been struggling for a while now to figure out how to order my Comments by RAND order rather than ASC or DESC.
I realise there is an option for ASC or DESC in the Discussion section of the WP Settings page, but there is no option for Random.
I have read this page: http://wordpress.org/support/topic/show-random-comment which says you can hard-code a RAND option in wp-includes/comment.php – but this does not override the option selected in the WordPress admin section.
From: $orderby = 'comment_date_gmt'; // Hard code for now
To: $orderby = rand; // Hard code for now
– doesn’t make a difference.
So, how do I randomise the order of my comments without writing my-own custom SQL? (I can’t do that for the project I’m working on).
(@thathurtabit)
13 years, 6 months ago
I’ve been struggling for a while now to figure out how to order my Comments by RAND order rather than ASC or DESC.
I realise there is an option for ASC or DESC in the Discussion section of the WP Settings page, but there is no option for Random.
I have read this page: http://wordpress.org/support/topic/show-random-comment which says you can hard-code a RAND option in wp-includes/comment.php – but this does not override the option selected in the WordPress admin section.
From:
$orderby = 'comment_date_gmt'; // Hard code for now
To:
$orderby = rand; // Hard code for now
– doesn’t make a difference.
So, how do I randomise the order of my comments without writing my-own custom SQL? (I can’t do that for the project I’m working on).
Many thanks!