Multisite: Allow to set the site language of a new site to English.

An empty string in `WPLANG` is used to define the site language as `en_US`. The `! empty()` check didn't catch this case so that `wpmu_create_blog()` fell back to the network setting.

Fixes #36918.

git-svn-id: https://develop.svn.wordpress.org/trunk@38655 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2016-09-26 18:38:32 +00:00
parent fa48bfa1d2
commit a1e9fbfc14
3 changed files with 58 additions and 6 deletions

View File

@@ -1092,7 +1092,10 @@ function wpmu_create_user( $user_name, $password, $email ) {
* @return int|WP_Error Returns WP_Error object on failure, int $blog_id on success
*/
function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $site_id = 1 ) {
$defaults = array( 'public' => 0 );
$defaults = array(
'public' => 0,
'WPLANG' => get_site_option( 'WPLANG' ),
);
$meta = wp_parse_args( $meta, $defaults );
$domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
@@ -1130,7 +1133,6 @@ function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $s
update_option( $key, $value );
}
add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
update_option( 'blog_public', (int) $meta['public'] );
if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )