How to Display Random Posts from Different Categories using WP_Query

How to Display Random Posts from Different Categories using WP_Query

Sometimes you want to mix things up a little when displaying posts on your site, maybe by making the list random instead of just showing the last five posts like every other site in town.

The great news is that if you add a custom query to your page using the WP_Query class, you can do this by using a special argument that will randomise your posts.

And what if you want to take it a bit further and show random posts from a variety of categories on your site, making sure the posts aren’t duplicated if they happen to be in more than one category?

Again, it’s possible.

In this post I’ll show you how to write a query that will output a random post…

Read Full Article