How to disable /random/ in WordPress 7.2

WordPress 7.2 enables /random/ by default, sending visitors to a random published post. Our free plugin Disable Random

How to disable /random/ in WordPress 7.2


WordPress 7.2 enables /random/ by default, sending visitors to a random published post. Our free plugin Disable Random Content turns off these redirects and lets you enable them for selected archives.

Categories and other archives have their own random URLs. For example, /random/category/blog/ opens a random post from the Blog category. What’s new in WordPress 7.2

The plugin turns off WordPress’s built-in random redirects as soon as you activate it. In version 1.3.0, we added the option to enable them for individual archives.

How to turn off random redirects

In your WordPress dashboard, go to Plugins → Add New Plugin, search for Disable Random Content, then install and activate it. The plugin updates your permalink rules automatically.

You can install and activate version 1.3.1 on WordPress 7.1 before upgrading. The plugin starts controlling /random/ when you upgrade to WordPress 7.2. We verified this on a test site by upgrading from 7.1.5 to 7.2 RC2.

WordPress Multisite

To disable random redirects across a WordPress Multisite network, network-activate Disable Random Content under Network Admin → Plugins. You can do this on WordPress 7.1 before upgrading.

We tested version 1.3.1 on a two-site network without page caching and upgraded from WordPress 7.1.5 to 7.2 RC2. With the plugin active, /random/ returned 404 on both sites after the rewrite rules were rebuilt. After network deactivation, the same URL returned 302 to a published post on each site.

How to keep a random link for your blog

Suppose you want to add a “Random post” button to your blog. Go to Settings → Disable Random Content, select the Blog category, and save your changes. If the category slug is blog, use /random/category/blog/ for the button. The site-wide /random/ URL stays off.

You can also enable random redirects for individual tags, terms in other public taxonomies, and supported post type archives. Download Disable Random Content

Try Disable Random Content in WordPress Playground. Compare the disabled site-wide /random/ with a working random link for the Blog category. The demo runs on a WordPress 7.2 test build.

Leave a Comment

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