• 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!

Viewing 1 replies (of 1 total)
  • Thread Starter thathurtabit

    (@thathurtabit)

    I found a way to do it by editing further sections of the SQL requests inside wp-includes/comment.php

    and adding this in:

    ORDER BY RAND()

    – it worked for me, though make sure you back up your files if you’re going to do the same.

Viewing 1 replies (of 1 total)
  • The topic ‘Comments ORDERBY = RAND?’ is closed to new replies.