Repository navigation
Reject site paths that shadow wp-json or core PHP files (Trac #40365) - #66
Merged
Merged
Conversation
lloc
marked this pull request as ready for review
October 24, 2026 09:22
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
169 |
WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound | Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "self::FILTER_MAX_SITES". |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
amiut
requested changes
Oct 26, 2026
amiut
approved these changes
Oct 26, 2026
amiut
left a comment
Member
There was a problem hiding this comment.
Thanks a lot for incorporating all the changes, LGTM 💪
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
POST /wp/v2/sitesandPUT /wp/v2/sites/<id>accept any well-formed path. In a subdirectory network, a site's path takes priority over everything beneath it so that a single request could take over network-wide routes:/wp-json/: every/wp-json/…request on the network went to the new site and returned a 404 HTML page, so the REST API was down until the site was deleted with WP-CLI. Only?rest_route=still worked./wp-login.php/: the network's login page rendered in the subsite's context, with that site's name, options and plugins, and/wp-admin/redirected there./xmlrpc.php/was accepted the same way.Changes
is_valid_path()now also rejects:get_subdirectory_reserved_names()(wp-json, wp-admin, wp-includes, wp-content, feed, embed, comments, blog, page, files). These are the names core already reserves for subdirectory sites.The patch and tests are synced verbatim from the wordpress-develop branch for #40365, which already has this change.