Title: Order comments randomly
Last modified: March 21, 2022

---

# Order comments randomly

 *  Resolved [dejman](https://wordpress.org/support/users/dejman/)
 * (@dejman)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/order-comments-randomly/)
 * This plugin does all I want except that I really need to display the comment 
   randomly. Any help please?
 * Even if I need to edit some codes. Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [gtsiokos](https://wordpress.org/support/users/gtsiokos/)
 * (@gtsiokos)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/order-comments-randomly/#post-15488856)
 * Hi dejman,
 * FYI, the comments are fetched from the db with a query which includes the usual
   query parameters including one for ordering how they are fetched.
 * IMHO you should also check the plugin API and especially the Filter hook _the\
   _comments_ found here: [https://docs.itthinx.com/document/decent-comments/api/](https://docs.itthinx.com/document/decent-comments/api/)
 * Perhaps this way you can randomize the array of comments the way you prefer. 
   Even though I haven’t tried it myself, in theory it should be possible.
 * Kind regards,
    George
 *  Plugin Author [itthinx](https://wordpress.org/support/users/itthinx/)
 * (@itthinx)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/order-comments-randomly/#post-15492107)
 * There is in fact a filter that can be used for this – although you should be 
   aware of the performance implications of a randomized query on a large amount
   of comments.
 * The filter is `the_comments` and it receives two bits in an array passed to it,
   the $comments and the Decent_Comments object that retrieves the comments. You
   can replace the $comments with those that you want, e.g. randomized ones.
 * This is where the filter is applied: [https://github.com/itthinx/decent-comments/blob/master/class-decent-comment.php#L300](https://github.com/itthinx/decent-comments/blob/master/class-decent-comment.php#L300)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Order comments randomly’ is closed to new replies.

 * ![](https://ps.w.org/decent-comments/assets/icon-256x256.png?rev=1693486)
 * [Decent Comments](https://wordpress.org/plugins/decent-comments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/decent-comments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/decent-comments/)
 * [Active Topics](https://wordpress.org/support/plugin/decent-comments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/decent-comments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/decent-comments/reviews/)

## Tags

 * [comment](https://wordpress.org/support/topic-tag/comment/)
 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [rand](https://wordpress.org/support/topic-tag/rand/)

 * 2 replies
 * 3 participants
 * Last reply from: [itthinx](https://wordpress.org/support/users/itthinx/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/order-comments-randomly/#post-15492107)
 * Status: resolved