---
title: "WordPress 7.2 Random Post URL Explained"
url: https://nexterwp.com/blog/wordpress-7-2-random-post-url/
date: 2026-11-05
modified: 2026-11-05
lang: en
author: "Aditya Sharma"
description: "WordPress 7.2 adds a built-in /random/ URL that sends readers to a random post. Learn the URL patterns, the randomable argument and how to disable it."
image: https://nexterwp.com/wp-content/uploads/2026/11/wordpress-7-2-random-post-url-1024x538.webp
word_count: 616
---

# WordPress 7.2 Random Post URL Explained

## Key Takeaways

- WordPress 7.2 adds a built-in /random/ URL that redirects to one randomly chosen published post, and the feature is on by default in the 7.2 beta.
- WordPress generates random URL patterns for archives such as /random/category/release/, /random/tag/dev-notes/, /random/author/jorbin/, and /random/{post-type-slug}/.
- register_post_type() adds a new randomable argument, and built-in posts are randomable while pages and attachments are not.
- wp_enable_random_content_redirect can turn the feature off, and setting it to false removes random rewrite rules, hides the Permalinks screen field, and ignores the random query variable.

WordPress 7.2 adds a built-in `/random/` URL. Visit `example.com/random/` and WordPress sends the reader to a randomly chosen published post. The feature is on by default, and a developer note posted on November 5, 2026 explains how it works and how to switch it off.

This guide covers the URL patterns, which post types qualify, how to limit what gets picked, and how to disable it. Every detail comes from the official [Your Content Is Going To Get More Random](https://make.wordpress.org/core/2026/11/05/your-content-is-going-to-get-more-random/) developer note, and the feature is in the 7.2 beta, not a final release.

Table of Contents

## What The Random URL Does

A request to `/random/` redirects the visitor to one randomly selected published post. The note says it is built on the existing rewrite, `WP` and `WP_Query` APIs, so it behaves like other archive requests. The base word is translatable and can be changed with a new option on the Permalinks screen in wp-admin.

## The URL Patterns

The random base is added in front of existing archive paths. With the default base and pretty permalinks, WordPress generates these rules:

| URL | Where it sends the visitor |
| --- | -------------------------- |
| `/random/` | A random post |
| `/random/category/release/` | A random post in that category |
| `/random/tag/dev-notes/` | A random post with that tag. Any publicly queryable taxonomy on an eligible post type gets a similar rule |
| `/random/author/jorbin/` | A random post by that author |
| `/random/{post-type-slug}/` | A random post of a custom post type that is randomable |

## Which Post Types Are Included

A new `randomable` argument on `register_post_type()` controls eligibility. If it is not set, it defaults to true for post types that are `publicly_queryable` and have `has_archive` set. Among the built-in types, posts are randomable, while pages and attachments are not.

To keep a custom post type out, set the argument to false when you register it:

`register_post_type(
'musicals',
array(
'public' => true,
'has_archive' => true,
'randomable' => false, // Keep musicals out of /random/.
)
);`

## Controlling What Gets Picked

The random post comes from the main query. During the request, `WP::handle_random()` adds three callbacks: `wp_random_content_pre_get_posts()` to restrict the query to eligible posts, `wp_random_content_posts_orderby()` to order by `RAND()`, and `wp_random_content_post_limits()` to return one row.

Because selection runs through the main query, any `pre_get_posts` callback that already customises an archive also affects its random redirect. To change only random requests, check the query with `wp_is_random_content_query()`:

`add_action(
'pre_get_posts',
static function ( WP_Query $query ) {
if ( wp_is_random_content_query( $query ) ) {
$query->set( 'category__not_in', array( 525600 ) );
}
}
);`

## How To Turn It Off

Use the `wp_enable_random_content_redirect` filter. A one-line mu-plugin does it:

`add_filter( 'wp_enable_random_content_redirect', '__return_false' );`

With the filter set to false, no random rewrite rules are generated, the random base field is hidden on the Permalinks screen, and the random query variable is ignored.

***Also Read:** [WordPress 7.2 Guide](https://nexterwp.com/blog/wordpress-7-2/) for the rest of what is coming in this release.*

## What Site Owners Should Check

- **Decide if you want it.** It is on by default, so every site with posts gains a `/random/` URL after upgrading.
- **Review excluded content.** Posts you would not want surfaced at random, such as outdated announcements, need a category or query rule to exclude them.
- **Check custom post types.** Types with public archives become eligible unless you set `randomable` to false.
- **Watch for conflicts.** A site that already uses `/random/` as a page or a custom rewrite should test the beta before 7.2 ships.

## What This Doesn’t Cover

This guide does not test the feature on a live site, and it does not cover caching or SEO behaviour of the redirect, which the note does not discuss. The 7.2 beta can still change before release. For crawling and indexing basics, read the guides below.

#### Suggested Reading

- [WordPress Sitemap](https://nexterwp.com/blog/wordpress-sitemap/)
- [Technical SEO Checklist](https://nexterwp.com/blog/technical-seo-checklist/)
- [WordPress Real-Time Collaboration](https://nexterwp.com/blog/wordpress-real-time-collaboration/)

#### Stay updated with Helpful WordPress Tips, Insider Insights, and Exclusive Updates – Subscribe now to keep up with Everything Happening on WordPress!

Subscribe

## Frequently Asked Questions

**Q: Why is my WordPress random post URL sending people to the same kind of content every time?**
A: The /random/ endpoint pulls from the main query and redirects to one randomly chosen published post, so what it can surface depends on which post types and taxonomies are eligible. Posts are included by default, while pages and attachments are not. If a custom post type is marked randomable, it can also appear under its own /random/{post-type-slug}/ path. That means the result set is controlled by eligibility first, not by the URL itself.

**Q: How do I stop a custom post type from showing up in the WordPress random post URL?**
A: Set randomable to false when registering the post type. The developer note shows this directly with a musicals example, where public and has_archive are true but randomable is false to keep it out of /random/. That matters because any publicly_queryable type with has_archive set becomes randomable by default unless you override it. For site owners, this is the cleanest way to keep specific content out of random rotation.

**Q: Does WordPress 7.2 random post URL work with categories, tags, authors, and custom post types?**
A: The URL patterns include all of those when the content type is eligible. WordPress generates rules like /random/category/release/ for a category archive, /random/tag/dev-notes/ for a tag archive, /random/author/jorbin/ for an author archive, and /random/{post-type-slug}/ for a randomable custom post type. Any publicly queryable taxonomy on an eligible post type gets a similar rule, so the feature follows normal archive structure instead of inventing a separate system.

**Q: How do I exclude outdated posts from WordPress random redirects?**
A: The redirect uses the main query, so exclusion has to happen at the query level. The page says you can use pre_get_posts and check wp_is_random_content_query() before changing only random requests. That lets you remove specific content with rules like category__not_in for a category you do not want surfaced. This is important because the feature is on by default, so old announcements or similar posts can show up unless you explicitly filter them out.

**Q: What should site owners check before WordPress 7.2 ships with /random/ enabled?**
A: Three things stand out: whether you actually want it, which content should be excluded, and whether any existing rewrite already uses /random/. The feature is on by default, so every site with posts gains a /random/ URL after upgrading. Custom post types with public archives become eligible unless randomable is set to false. If your site already uses /random/ as a page or custom rewrite, test that conflict before release because this beta can still change.
