Display random posts in WordPress

WordPress posts may be randomly displayed using the “Get random results from a MySql table” tip placed in a simple plugin.

What this plugin does is to simply add the “RAND()” value to “ORDER BY” clause in the sql query which retrieves the WordPress posts.

In order to use the plugin, just place the above code in a file, upload it to your WordPress plugins directory and activate it. If you use cache related plugins it may be necessary to disable them to view the randomized posts.

Published by Cristian Radulescu

PHP // MySql // Linux

Join the Conversation

5 Comments

  1. I’ve been using the Rand code for a while now but i can’t get it to work with the latest version of wordpress (3.2.1) have you noticed this? do you have any fixes or alternatives?

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.