REST API: Register the admin_email setting in single site only.

Merges [39470] and [39471] to the 4.7 branch.

fixes #38990.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39472 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2016-12-03 05:41:52 +00:00
parent 3b3a0f0a68
commit 3bcc86a908
2 changed files with 14 additions and 13 deletions

View File

@ -1750,16 +1750,18 @@ function register_initial_settings() {
) );
}
register_setting( 'general', 'admin_email', array(
'show_in_rest' => array(
'name' => 'email',
'schema' => array(
'format' => 'email',
if ( ! is_multisite() ) {
register_setting( 'general', 'admin_email', array(
'show_in_rest' => array(
'name' => 'email',
'schema' => array(
'format' => 'email',
),
),
),
'type' => 'string',
'description' => is_multisite() ? __( 'This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. The new address will not become active until confirmed.' ) : __( 'This address is used for admin purposes, like new user notification.' ),
) );
'type' => 'string',
'description' => __( 'This address is used for admin purposes, like new user notification.' ),
) );
}
register_setting( 'general', 'timezone_string', array(
'show_in_rest' => array(

View File

@ -54,8 +54,6 @@ class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase
$expected = array(
'title',
'description',
'url',
'email',
'timezone',
'date_format',
'time_format',
@ -69,8 +67,9 @@ class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase
'default_comment_status',
);
if ( is_multisite() ) {
$expected = array_diff( $expected, array( 'url' ) );
if ( ! is_multisite() ) {
$expected[] = 'url';
$expected[] = 'email';
}
sort( $expected );