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
+8 -4
View File
@@ -65,10 +65,14 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
);
// Handle translation install for the new site.
if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) {
$language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
if ( $language ) {
$meta['WPLANG'] = $language;
if ( isset( $_POST['WPLANG'] ) ) {
if ( '' === $_POST['WPLANG'] ) {
$meta['WPLANG'] = ''; // en_US
} elseif ( wp_can_install_language_pack() ) {
$language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
if ( $language ) {
$meta['WPLANG'] = $language;
}
}
}