As of 2026-11-05, WordPress 7.2 is in beta. Beta 4 shipped on November 3, and the final release is scheduled for December 8, 2026. One of the new features is on by default: a /random/ URL that redirects visitors to a random published post.
On a client site, a store, or anywhere a “surprise me” link makes no sense, you probably want it off before 7.2 lands. If you like it, you can still decide what it picks. Both take a few lines of PHP.
What /random/ adds to your site
With pretty permalinks enabled, 7.2 registers rewrite rules for these URLs, according to the core dev note:
/random/redirects to a random post/random/category/{slug}/picks a random post from that category, and other public taxonomies such as tags get the same pattern/random/author/{name}/picks a random post by that author/random/{post-type-slug}/picks a random entry of an eligible custom post type
A new randomable argument on register_post_type() decides which post types are eligible. When it isn’t set, it defaults to true for post types that are publicly_queryable and have has_archive enabled. Regular posts are in. Pages and attachments are not.
The word “random” is translatable, and you can change it in a new field under Settings > Permalinks.
To see whether the rules exist on a site running 7.2 (or the beta on staging), list the rewrite rules with WP-CLI:
wp rewrite list | grep random
If the feature is active, you get rules that start with the random base. No output means there are no random rules. On a translated site, grep for your localized base instead.
Turn the random redirect off with a mu-plugin
Core gives you one switch for this: the wp_enable_random_content_redirect filter. Return false and WordPress stops generating the random rewrite rules, hides the base field on the permalinks screen and ignores the random query variable.
I put this in a must-use plugin rather than the theme’s functions.php. A mu-plugin keeps working when someone switches themes, and nobody can deactivate it by accident from the Plugins screen.
Step 1. Back up and create the mu-plugins folder
Back up wp-content first. Then, from the WordPress root, create the folder if it doesn’t exist yet:
mkdir -p wp-content/mu-plugins
Step 2. Add the filter
Create wp-content/mu-plugins/disable-random-redirect.php with this content:
<?php
/**
* Plugin Name: Disable /random/ redirect
* Description: Turns off the random content redirect added in WordPress 7.2.
*/
add_filter( 'wp_enable_random_content_redirect', '__return_false' );
On WordPress 7.1 and older nothing listens to this filter, so the file is harmless there. You can deploy it today and it takes effect the moment the site updates to 7.2.
Step 3. Flush the rewrite rules
WordPress keeps its compiled rewrite rules in the database, so rebuild them after adding the file:
wp rewrite flush
You should see Success: Rewrite rules flushed. No shell access? Open Settings > Permalinks and click Save Changes, which rebuilds the rules too.
Step 4. Confirm the redirect is gone
Run wp rewrite list | grep random again. It should return nothing, and example.com/random/ should no longer send you to a post. Also check Settings > Permalinks: the random base field should be gone.
💡 If you already have a page with the slug random, test it on a 7.2 staging copy before updating production, so you know what visitors get at that URL.
Keep /random/ but exclude a post type
Maybe you like the feature but don’t want every post type in the pool. If the post type is yours, set randomable to false where you register it:
register_post_type(
'portfolio',
array(
'public' => true,
'has_archive' => true,
'randomable' => false, // Keep portfolio items out of /random/.
)
);
For a post type registered by a plugin you don’t control, don’t edit the plugin. Change its arguments with the register_post_type_args filter from your mu-plugin instead:
add_filter( 'register_post_type_args', function ( $args, $post_type ) {
if ( 'product' === $post_type ) {
$args['randomable'] = false;
}
return $args;
}, 10, 2 );
Swap product for the post type you want out. On a WooCommerce store, run the grep from earlier after updating to 7.2 and check whether products show up in the random rules. Flush the rewrite rules again after any change to randomable.
Keep a category out of the random picks
Random requests go through the normal main query, so your existing pre_get_posts callbacks already apply to them. To change the selection only for random requests, check the query with wp_is_random_content_query():
add_action( 'pre_get_posts', function ( $query ) {
if ( function_exists( 'wp_is_random_content_query' ) && wp_is_random_content_query( $query ) ) {
$query->set( 'category__not_in', array( 12 ) );
}
} );
Replace 12 with the ID of the category to leave out, like sponsored posts or old announcements. The function_exists() check matters: the function only exists from 7.2, and calling it on 7.1 would be a fatal error.
If you ever need a random post on one specific page instead of a site-wide URL, a shortcode still does the job. I covered that in how to display a random WordPress post inside a page.
Should you leave it on?
My take: on a blog with years of archives, /random/ is a nice way to resurface old posts. On a business site, a shop or a membership site I turn it off. It’s one more public URL that nobody asked for.
If you keep it, check two things. First, make sure your page cache or CDN doesn’t store the /random/ redirect. If it does, every visitor lands on the same post until the cache expires, so exclude that path from caching.
Second, decide whether search engines should crawl it. A redirect that changes on every request adds nothing for a crawler, and a Disallow: /random/ line in robots.txt keeps them away from it.
Don’t wait for a checkbox. In the comments on the dev note, a site builder asked for a core setting to turn it off. The reply pointed to WordPress’s philosophy of not adding an option for every feature. The filter is the official off switch, the same approach core took with client-side image processing in 7.1.
While you prepare staging for 7.2, also check the other change in this release: load-scripts.php is removed, which means some old lines in wp-config.php can go.
TL;DR: WordPress 7.2 (scheduled for December 8, 2026) adds a /random/ redirect that is on by default. To turn it off, add add_filter( 'wp_enable_random_content_redirect', '__return_false' ); in a mu-plugin and flush the rewrite rules. To keep it but narrow it down, use randomable, the register_post_type_args filter or wp_is_random_content_query() in pre_get_posts.

