how to get random posts in wordpress

how to get random posts in wordpress

Wordpres tutorial, how to get random posts in wordpress. Many times we need the random post from wordpress. Like for old tweet or if you want random posts.  Like for old tweet or if you want to show random posts on home page. That is very easy wordpress provided simple method for this.

how to get random posts in wordpress

You just need to add the following query post code before loop.


 <?php query_posts(array('orderby' => 'rand')); ?>

//post data code will go here.

This way can easily show the random posts on home page.

Above is manual method for showing random posts in wordpress. If you want to show random posts using wordpress plugin than use smart widget post.

how to get random posts in wordpress

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

4 thoughts on “how to get random posts in wordpress”

Leave a Reply

Your email address will not be published.