[Task]: Decide how Yoast SEO handles the WordPress 7.2 random content URLs
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
Research direction
Start by reading the wp_enable_random_content_redirect and pre_get_posts hooks named in the issue, then review Yoast SEO's Crawl optimization settings and rewrite-rule handling. Decide the defaults, noindex behavior, multisite setting changes, and post-type scope before implementation. Done means the behavior is shipped before WordPress 7.2, with updated Crawl optimization help and compatibility notes.
Written by the indexing model from the issue text.
Description
Context - Why was this issue created?
WordPress 7.2 adds random content URLs, announced in Your content is going to get more random (Trac ticket #64498). The feature is on by default.
A request to one of these URLs sends the visitor to a randomly picked published post:
/random/picks any post./random/category/{slug}/,/random/tag/{slug}/and other taxonomy archives pick a post from that term./random/author/{nicename}/picks a post by that author./random/{post-type}/picks a post of that post type.- Adding
?randomto any archive or search URL does the same for that archive.
Post types take part when they are public and have an archive, unless they register with 'randomable' => false. Site owners can turn the feature off with the wp_enable_random_content_redirect filter.
What doesn't break for Yoast SEO: WordPress sends the redirect before our front-end output runs, so our titles, canonical URLs and schema don't run on these URLs. WordPress answers with a temporary redirect (HTTP 302) and an X-Robots-Tag: noindex, follow header. Premium redirects run earlier, so a redirect that a user sets up for /random/ still takes priority.
What can affect our users:
- Content set to noindex in Yoast SEO can show up. WordPress picks the post with its own rules only: published, no password, and an eligible post type. It ignores the Yoast SEO noindex setting, both for a whole post type and for a single post. A post that a site owner hid from search engines can be reached through these URLs.
- The site gets many more public URLs. Every category, tag and author archive gains a random version that bots can crawl.
- Each request can be slow on large sites. WordPress picks the post by sorting the matching posts randomly in the database, which gets slower as the number of posts grows.
What is the goal of this issue?
Decide how Yoast SEO handles random content URLs, and ship the result before WordPress 7.2 is released.
What needs to be done to achieve the goal?
Evaluate the following:
- A Crawl optimization toggle to remove random content URLs. It would return
falseon thewp_enable_random_content_redirectfilter. This fits next to the existing toggles that remove feeds, shortlinks and emoji scripts. - Whether the toggle removes the URLs by default. Decide this for new installs and for existing sites on upgrade.
- Respecting Yoast SEO noindex settings when the URLs stay enabled. When WordPress picks the random post, leave out post types and posts that are set to noindex in Yoast SEO.
- A post set to index inside a post type set to noindex would be left out too. This matches the XML sitemap, which skips the whole post type and only reads the per-post setting to drop posts.
- Noindex means "keep out of search results," not "hide from visitors." Some sites noindex a post type to keep thin pages out of Google but still want visitors to find them at random. Evaluate a filter, such as
wpseo_random_content_exclude_noindexed, that lets those sites keep noindexed content in the selection, rather than a second toggle.
- A second toggle to limit random content URLs to posts. When the URLs stay enabled, WordPress picks from every public post type with an archive, such as products or portfolio items. This toggle would restrict the pick to regular posts only, for sites that want the feature for their blog but not for their other content.
- Evaluate how it combines with the noindex handling above, and whether
/random/{post-type}/URLs for other post types should then return a "not found" page.
- Evaluate how it combines with the noindex handling above, and whether
- Clearing the stored rewrite rules (the URL patterns WordPress saves in the database) when the setting changes. WordPress requires this after the filter's value changes. On multisite, this includes every site in the network when a network admin allows or disallows the setting.
- Clearing every site while the network settings are saved can time out on networks with thousands of sites. Evaluate letting each site clear its own rules on its next request instead, by comparing a counter in the network settings with one in the site's settings.
- Showing the toggle only on WordPress versions that support the feature. This includes the settings page, the network settings and the settings search.
- Release timing. Ship before WordPress 7.2, and mention it in the WordPress 7.2 compatibility notes.
Does the issue still need UX or research?
Yes. Decide the toggle's placement and wording on the Crawl optimization page, and whether removing the URLs should be the default.
If available, what are the tips for fixing the problem or possible solutions?
- Register the filter on every request, not only on the front end. WordPress also builds the rewrite rules during admin requests.
- Use
wp_is_random_content_query()in apre_get_postscallback to change only the random selection query and leave all other queries untouched. - Yoast SEO already clears rewrite rules after every plugin upgrade, so stale
/random/rules disappear on update.
What is the expected result/behavior?
Site owners control random content URLs from the Crawl optimization settings. Content they set to noindex in Yoast SEO never shows up through these URLs.
Should documentation be added or updated for this change? And if so, where?
Yes. Update the Crawl optimization help article, and add a line to the WordPress 7.2 compatibility notes.
- Dominant language
- JavaScript
- Stars
- 2k
- Forks
- 988
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 66
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Yoast/wordpress-seo
-
[Feature]: Add Crawl Optimization setting to disable WordPress random content redirect (WP 7.2)Openenhancement featurerequest
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Yoast/wordpress-seo#23888 ·
Maintainers usually reply within 4 days
-
[Bug]: languages/pl.js breaks SEO Optimization Tool when object property name appears in analyzed textPossibly taken @MrDezzan claimed this 9 days ago. Openbug Can't reproduce needs-more-info
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Yoast/wordpress-seo#23840 · 1 comment ·
Maintainers usually reply within 4 days
-
[Bug]: PHP 8.6: bundled guzzlehttp/promises loads class `Is` → "Using "is" as a class name is deprecated"Possibly taken @nadeem-khan claimed this 31 days ago. Openbug patch welcome php 8.6
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Yoast/wordpress-seo#23747 · 2 comments ·
Maintainers usually reply within 4 days
-
bulk editor access check calls current_user_can( edit_post ) without object ID, triggers PHP warnings in BuddyBoss/bbPressPossibly taken @alizamani1616 claimed this 60 days ago. Openbug component: bulk editor support
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Yoast/wordpress-seo#23669 ·
Maintainers usually reply within 4 days
-
Sitemap pagination silently drops pages when `post_modified` is not unique (`ORDER BY post_modified ASC` + OFFSET)Possibly taken @faisalahammad claimed this 49 days ago. Opencomponent: xml sitemap has patch
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Yoast/wordpress-seo#23658 · 3 comments ·
Maintainers usually reply within 4 days
All issues in Yoast/wordpress-seo
Similar issues
-
check:passed feeds:remove
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
githubnext/gh-aw-workshop#6428 ·
Maintainers usually reply within 1 day
-
docs
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
idean3885/claude-ops-agent#1346 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
linagora/twake-drive#4681 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Autokey cipher decode corrupts text that contains lowercase lettersPossibly taken @hakarrr claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100