How to Redirect Users to a Random Post in WordPress?

Do you know how to redirect users to a random post in WordPress? A random post permits users to explore older articles and read posts that are invisible in your blog archives.

In WordPress, you can configure random post for your website. Random post means whenever a user will refresh a page or click on a button they will get every time new post and the post will change automatically.

In this article, we will describe how to easily redirect users to a random post in WordPress.

Why should you redirect users to a random post?

By default, WordPress posts appear in reverse sequential order, so your users will read the latest post first. If you write regularly on your site then users may not be able to find your older article.

Another way to control this issue is to display random posts in the sidebar of your blog. It will allow users to discover new content while increasing your page views.

You can also redirect users to random post from 404 error pages or add a ‘Surprise Me’ button in your blogs custom archive pages which takes users to a random post.

That being said, let’s take a look at how to redirect users to a random post in WordPress. And our WordPress Technical Support and Service team always providing the ongoing support to keep your website running safe and secure.

Why and where to display the random post in WordPress?

By default, WordPress lists your content posts in reverse order (from newest to oldest). This allows visitors to see your newest post first.

However, most of the visitors will not get to look at your older articles. If you have been working on your own website for quite some time now, then your older materials will not prominently saw anywhere.

Only one way to subdue this is by building an internal linking a habit. Connecting to your older blogs in new posts will help users find them. It will also extend your pageviews and improve your SEO score.

Redirecting users to a random post in WordPress

The first thing you have to do is to install and activate the redirect URL to post plugin. To collect more details, see our blog on how to install a  WordPress analytics plugin.

After activation, you’ll find the URL query parameters for redirection on the WordPress plugins page on your website. There is no setting page on this plugin.

You can utilize any of these query parameters in your blog posts and pages to redirect the user to arbitrary post, new posts, and other older article.

To redirect users to a casual post, you need to copy the random post query parameter from here and attach as a link it in your error pages and other pages.

After clicking on the link will redirect users to multiple random posts. You can also append a button for redirection on your content. Easily combine this shortcode in your WordPress site posts and pages to represent the random post button.

Whenever users hit this button, they will be redirected to a random post on your site.

WordPress helps random redirection out of the box, but it’s not very clear. All of the required functions always available in the core. But these are not connected in any common workflow.  

For example, creating a “Random article” link in the main menu simply by hit a box in the administration section is not possible.

To achieve random redirection in a WordPress website, you will usually need to work with the following three things:

  • A page redirection to the process.
  • A query to choose a post from the database.
  • Some sort of tool to initiate the redirection.

Sure, anyone of you might want to use a plugin. That’s surely fine, as long as you don’t need any other features than what it suggests.

You would reasonably come across Matt Mullenweg’s Random Redirect plugin first. Then you would probably try Random Redirect 2, which expands on that.

Rather, today I am going to explain a custom implementation that I use. It’s not the better way to execute random redirection, only one plugin is not enough for the solution to start with.

Display the random posts in WordPress with a Plugin

This method is very easy and is suggested for most users.

Firstly you will need to install and activate the Advanced Random Posts Widget plugin.

After activation, you will need to go Appearance >> Widgets page. You will notice a new widget labeled ‘Random Posts’ under the list of the available widget.

After that, you need to add this widget to a sidebar. Now, you will able to look at the widget settings button.

This default options will work for most sites. After that, you just click on the save button. Now, you are able to visit your site to look at random posts widget in action.

Conclusion

Wrapping this all end! Here, we have discussed how to redirect users to a random post in WordPress?

Often, we searched how to redirect users to a random post in WordPress? Thus, we hope this blog will help you to choose the best site builder.

However, If you have any problem with the same, then, let me know in the comments section. If you liked this post, please share it with your friends.

Scroll to Top