Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Redirect Users to a Random Post in WordPress

Do you want to redirect users to a random post? A random post allows users to explore older articles and read posts that are hidden in your blog archives. In this article, we will show you how to easily redirect users to a random post in WordPress.

How to redirect users to a random post in WordPress

Why You Should Redirect Users to a Random Post?

By default, WordPress posts appear in reverse chronological order (from newest to oldest), so your users will read the latest post first. If you write regularly on your blog, then your users may not be able to discover your older articles.

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

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

That being said, let’s take a look on how to redirect users to a random post in WordPress.

Video Tutorial

Subscribe to WPBeginner

If you don’t want to watch the video tutorial, then you can continue reading the text version below:

Redirecting Users to a Random Post in WordPress

First thing you need to do is to install and activate the Redirect URL to Post plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you’ll see the URL query parameters for redirection on the WordPress plugins page. This plugin has no other settings page.

You can use any of these query parameters in your posts and pages to redirect users to random posts, latest posts, and other older articles.

Redirect URL parameters

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

Clicking on the link will redirect users to a different random post.

You can also add a button for redirection on your blog. Simply add this shortcode in your WordPress posts and pages to display the random post button.

[redirect_to_post_button]

When users click on this button, they will be redirected to a random post on your website.

Random post button

We hope this article helped you learn how to redirect users to a random post in WordPress. You may also want to see our expert pick of the best WordPress search plugins to improve your site search.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

9 CommentsLeave a Reply

  1. Is that possible to randomly redirect to part of the post? I am thinking of something that allows user to post something under a type, and other user will randomly see one of the post belongs to that category, but not randomly from all the posts

    • If you mean you are going to add user-submitted posts then the plugin does have the option to limit the random post selected to those within the specific category or other parameters.

      Admin

    • It would require coding knowledge and would not be beginner friendly if you tried to do it manually.

      Admin

  2. Hi,

    I have a website created in WordPress.com. I wanted to have a self hosted site so i moved it to Site Ground. I also wanted to have my site in WordPress.org so I could have more freedom to change my site. Can you help me how I can move my site to WordPress.org? Thanks.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.