mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Multisite: Introduce get_subdirectory_reserved_names(), which returns a filterable list of reserved subdirectory site names.
The function encapsulates the existing `subdirectory_reserved_names` filter and reduces the maintenance burden of keeping the value of (currently) two instances of the same hook in sync. See #33615. git-svn-id: https://develop.svn.wordpress.org/trunk@34854 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -555,19 +555,7 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
|
||||
* spring them from jail.
|
||||
*/
|
||||
if ( ! is_subdomain_install() ) {
|
||||
$illegal_names = array_merge(
|
||||
$illegal_names,
|
||||
/**
|
||||
* Filter reserved site names on a sub-directory Multisite install.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.4.0 'wp-admin', 'wp-content', 'wp-includes', 'wp-json', and 'embed' were added
|
||||
* to the reserved names list.
|
||||
*
|
||||
* @param array $subdirectory_reserved_names Array of reserved names.
|
||||
*/
|
||||
apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed', 'wp-admin', 'wp-content', 'wp-includes', 'wp-json', 'embed' ) )
|
||||
);
|
||||
$illegal_names = array_merge( $illegal_names, get_subdirectory_reserved_names() );
|
||||
}
|
||||
|
||||
if ( empty( $blogname ) )
|
||||
@@ -2468,3 +2456,28 @@ function wp_get_sites( $args = array() ) {
|
||||
|
||||
return $site_results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of reserved site on a sub-directory Multisite install.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @return array $names Array of reserved subdirectory names.
|
||||
*/
|
||||
function get_subdirectory_reserved_names() {
|
||||
$names = array(
|
||||
'page', 'comments', 'blog', 'files', 'feed', 'wp-admin',
|
||||
'wp-content', 'wp-includes', 'wp-json', 'embed'
|
||||
);
|
||||
|
||||
/**
|
||||
* Filter reserved site names on a sub-directory Multisite install.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.4.0 'wp-admin', 'wp-content', 'wp-includes', 'wp-json', and 'embed' were added
|
||||
* to the reserved names list.
|
||||
*
|
||||
* @param array $subdirectory_reserved_names Array of reserved names.
|
||||
*/
|
||||
return apply_filters( 'subdirectory_reserved_names', $names );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user