Make WordPress Core

Opened 14 months ago

Last modified 2 months ago

#60659 new defect (bug)

get_subdirectory_reserved_name bypass on mutlisite

Reported by: knightrider123's profile knightrider123 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.4.3
Component: Networks and Sites Keywords: 2nd-opinion
Focuses: multisite Cc:

Description

By default on Multisite installation, you cannot have subsite(subdirectory) with name /blog/ due to: https://developer.wordpress.org/reference/functions/get_subdirectory_reserved_names/ as this tigger an error when you try to create such subsite:

The following words are reserved for use by WordPress functions and cannot be used as site names: page, comments, blog, files, feed, wp-admin, wp-content, wp-includes, wp-json, embed

But you can bypass that by creating subsite /aaa/ and edit name later on in network. I wonder is that a bug, and if so will it cause any issues using such subsites slug?

The only one I have found so far is that if on main site you will have /blog/ page slug, after re-save slug will get the number at the end.

Also, if you can bypass that, maybe it should be removed from reserved list?

Apart from /blog/ slug I was able to replicate that for /comments/ using same bypass.

I could not find any information in that matter.

Thank you

Change History (1)

#1 @realloc
2 months ago

  • Keywords 2nd-opinion added

I wouldn’t consider this a bug.

The functionality works as follows: A user cannot add a new site with the name “blog”. However, as a network admin, you have the ability to override this. Additionally, as a developer, you can override it using the subdirectory_reserved_names filter.

You can find more details in the section "User Contributed Notes" of the page that you mentioned:
https://developer.wordpress.org/reference/functions/get_subdirectory_reserved_names/#user-contributed-notes

Last edited 2 months ago by realloc (previous) (diff)
Note: See TracTickets for help on using tickets.