AI, Development & Tech News

WordPress 7.2 introduces the /random/ address for random posts

261105 wordpress random random post featured image
Skip to table of contents
Contents 5 sections
  1. Which random URLs does WordPress create?
  2. Which content may WordPress serve randomly?
  3. How do you disable the redirect?
  4. What this means for you
  5. Sources

Visitors who open deine-seite.de/random/ will, with WordPress 7.2, be taken to a randomly selected, published post on the site. Aaron Jorbin describes the new feature in the Dev Note (developer notice) from the Core team dated November 5, 2026. The redirect is enabled by default and builds on the existing Rewrite API and the WP and WP_Query classes.

According to the Core team's schedule, WordPress 7.2 will be released on December 8, 2026, with the fifth beta scheduled for November 10.

Which random URLs does WordPress create?

With Pretty Permalinks enabled and the default path, WordPress creates rules for four URL forms. The URL /random/ leads to any post, /random/category/release/ to a post in the category release, /random/author/jorbin/ to a post by this author, and /random/{post-type-slug}/ to a post of a custom post type, provided it is enabled for this.

Four random URLs in WordPress 7.2
Default path random, with Pretty Permalinks enabled, according to the Dev Note from November 5, 2026
URLredirects to
  • /random/Any post on the site
  • /random/category/release/Post in the category release
  • /random/author/jorbin/Post by this author
  • /random/{post-type-slug}/Post of a custom post type
WordPress 7.2 is still in beta, the release is planned for December 8, 2026
Sources: Make WordPress Core

Every publicly queryable taxonomy of a suitable post type gets a similar rule, in Jorbin's example /random/tag/dev-note/. The base path random can be translated and changed via a new option on the wp-admin/options-permalink.php page. A German site could, for example, change it to /zufall/.

Which content may WordPress serve randomly?

Using the new argument randomable in register_post_type(), you determine whether a post type participates. If the argument is missing, the default value true applies to types that are publicly queryable (publicly_queryable) and have an archive (has_archive). Of the built-in types, post is included, page and attachment are not. In Jorbin's example, a type called musicals is left out because randomable is set to false.

The selection is handled by the main query (Main Query). For the duration of the request, WordPress hooks in three callbacks: wp_random_content_pre_get_posts(), wp_random_content_posts_orderby(), and wp_random_content_post_limits(). Together, these callbacks restrict the query to suitable posts, sort by RAND(), and return exactly one result.

Because the selection runs through the main query, existing pre_get_posts callbacks that modify an archive also affect the random redirect of that archive. If only the random selection is to change, wp_is_random_content_query() determines whether such a query is present. In Jorbin's example, a single category is excluded this way.

How do you disable the redirect?

The filter wp_enable_random_content_redirect with the return value false disables the entire feature. WordPress then creates no rewrite rules for random URLs, hides the base field on the permalink page, and ignores the query variable. As a small must-use plugin, one line is enough: add_filter( 'wp_enable_random_content_redirect', '__return_false' ); The post does not mention a setting in the backend for this.

What this means for you

On websites with client posts, internal landing pages, or custom post types, a short test is worthwhile before December 8:

  • Ideally, on a test installation with the current 7.2 beta, open the URL /random/ and note which posts are displayed there.
  • For custom post types, set randomable to false or exclude individual categories via wp_is_random_content_query as soon as posts should not be served randomly.

If the feature doesn't fit your site at all, add the filter via a must-use plugin before the update to 7.2 runs. For a blog with many older posts, /random/ can serve as a menu item for browsing.

The Core team described the new feature on November 5, 2026.

Sources

Comments

Register and comment.

Continue reading

You might also like

View all articles →