mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01: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. Built from https://develop.svn.wordpress.org/trunk@34854 git-svn-id: http://core.svn.wordpress.org/trunk@34819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2003bc15ba
commit
65133a89c1
@ -46,10 +46,11 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
|
||||
|
||||
// If not a subdomain install, make sure the domain isn't a reserved word
|
||||
if ( ! is_subdomain_install() ) {
|
||||
/** This filter is documented in wp-includes/ms-functions.php */
|
||||
$subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'embed', 'files', 'feed', 'wp-admin', 'wp-content', 'wp-includes', 'wp-json' ) );
|
||||
if ( in_array( $domain, $subdirectory_reserved_names ) )
|
||||
wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) );
|
||||
$subdirectory_reserved_names = get_subdirectory_reserved_names();
|
||||
|
||||
if ( in_array( $domain, $subdirectory_reserved_names ) ) {
|
||||
wp_die( sprintf( __( 'The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
$title = $blog['title'];
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-alpha-34853';
|
||||
$wp_version = '4.4-alpha-34854';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user