How to Add a Redirect for Random Posts in WordPress

A redirect takes users to a pre-defined location on the website. But what if you want to randomize what visitors see? That’s when you add a redirect to random posts in WordPress.

And it’s not overly difficult. It just requires an add-on to URLs you add to content and a certain plugin.

In this tutorial, I’ll show you how to add redirects to random posts in WordPress and ways you can use it to your advantage.

Why Add a WordPress Random Post Link?

If you create content on a regular basis, pertinent content may become buried in newer posts. The “Latest Posts” widget can only hold so much, and what if you want people to have the chance of seeing something created last week?

Randomizing links also has potential to help you get visits on pages that don’t normally perform well in search results. This means stellar content you created years ago could still experience a bit of traffic.

If you add a button to the mix, it makes the content seem a bit more interactive. Which is an aspect many visitors look for in a great website.

Using Redirect URL to Post

Today, I’ll demonstrate the “Redirect URL to Post” plugin. This is an ultra-simple tool that merely lets WordPress recognize additions to links you place in content.

The plugin has no configurable settings and only affects the user’s browser. Think of it like teaching WordPress a few new words.

Install and activate, “Redirect URL to Post.”

Redirect URL To Post

Once you activate the plugin, you’ll see a thank you message. This also shows the various ways you can use URLs in the site, such as getting a random post in WordPress or a random post in the past month.

URL Addons

You can also see this list by visiting the plugin’s documentation.

Making the WordPress Redirect Random Post Link

With the plugin installed, it’s time to add the random post generator to WordPress posts and pages.

Go to any post or page in WordPress, or you can create a new one.

Go To Post

Create a text link but add the following after the URL:
[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]/?redirect_to=random[/ht_message]

Random Link

The URL in the link should look something like: “https://yourwebsite.com/?redirect_to=random

Except instead of “yourwebsite.com,” it should have your own domain.

Anyone clicking on the link will be taken to a randomized post you have saved in WordPress.

Adding a Random Post Button

As an alternative to using links to add redirects to random posts in WordPress, you can also use a button shortcode. It’s a basic button with no real features, but it will do the same thing as the link described above.

The only difference is that you won’t have to add the URL as a text link.

Add this shortcode anywhere on your post or page.
[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ][redirect_to_post_button][/ht_message]

Add Shortcode

The “Random Post” button will appear in your content.

Random Post Button

Will this randomize pages on the website as well?

Redirect URL to Post only randomizes posts saved on your website. Pages are not included, although you can add the random links to pages…such as in the About Us section or perhaps a landing page of some sort.

Other Plugins to Try

Redirect URL to Posts is a simple and easy-to-use plugin. But what if it’s not exactly what you’re looking for? Here are a few other plugins you can try to add random content for visitors to click.

Better Random Redirect

Better Random Redirects

Better Random Redirect is similar to the plugin above, except you have more control over the tool. For example, you can easily create shortcodes based on specific categories, post types and create cache times.

This may simply make the process of adding shortcode links easier depending on what you want to deliver to visitors.

Advanced Random Posts Widget

Advanced Random Posts Widget

Advanced Random Posts Widget is a simple add-on to display a list of random posts on the website. Using the included shortcodes, you can display a list of titles to visitors on virtually any post or page.

It comes with a full range of shortcode adjustments such as showing thumbnails, categories and the number of links shown to visitors.

Random Posts and Pages

Random Posts And Pages

Random Posts and Pages adds a bit of activity to the sidebar of your website. The plugin takes random content and puts them into a list which is in constant motion. It has potential as a fun element to give the site a bit of pizzazz.

The sidebar widget has several options for customization to make it fit your site’s aesthetics.

Adding More to the Site

Adding a redirect for random posts in WordPress can help people find older content and keep the site feeling fresh and active. And since in some cases it’s simply a URL add-on, it doesn’t take away from site resources.

Help your visitors find those older pieces, especially if the posts are evergreen. It helps to keep your site relevant to readers.

How do you keep people interested on your site to improve visitor retention rates? Do you find tools like those listed above helpful for getting more views per visitor?

1 thought on “How to Add a Redirect for Random Posts in WordPress”

  1. Thank you for that great article! Just a tiny correction about Redirect URL to Post: It does support other post types than posts: Simply add post_type=xxx You can also set the time of caching with cache=xxx (in seconds – default is 60) – unlike other plugins it’s all configured as URL parameters.

    So combining both you could end up with something like: … /?redirect_to=random&post_type=page&cache=300

    You can find all the parameters at https://documentation.chattymango.com/documentation/redirect-url-to-post/getting-started-redirect-url-to-post/search-parameters/

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.