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.
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
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.
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.
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.
Wesley Huang says
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
WPBeginner Support says
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
daniel says
Is there a way to do this mannually ?
WPBeginner Support says
It would require coding knowledge and would not be beginner friendly if you tried to do it manually.
Admin
Xolani says
What parameters to use to redirect users to a random custom post type?
Chris says
You can redirect to a random post from a custom post type by adding the parameter post_type, for example …?redirect_to=random&post_type=product
See all parameters at https://documentation.chattymango.com/documentation/redirect-url-to-post/getting-started-redirect-url-to-post/search-parameters/
Unfortunately, the plugin cannot pick a random post type out of a set of post types, if that’s what you need.
Elena says
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.
WPBeginner Support says
Hi Elena,
Please see our article on how to move from WordPress.com to WordPress.org.
Admin
Rodney Coleman says
Interesting read and very handy plugin. Thanks for the heads up..