diff --git src/wp-includes/option.php src/wp-includes/option.php
index aa98477..aad0830 100644
|
|
|
function register_initial_settings() {
|
| 1737 | 1737 | 'description' => __( 'Site tagline.' ), |
| 1738 | 1738 | ) ); |
| 1739 | 1739 | |
| 1740 | | register_setting( 'general', 'siteurl', array( |
| 1741 | | 'show_in_rest' => array( |
| | 1740 | if ( is_multisite() ) { |
| | 1741 | $siteurl_in_rest = false; |
| | 1742 | } else { |
| | 1743 | $siteurl_in_rest = array( |
| 1742 | 1744 | 'name' => 'url', |
| 1743 | 1745 | 'schema' => array( |
| 1744 | 1746 | 'format' => 'uri', |
| 1745 | 1747 | ), |
| 1746 | | ), |
| | 1748 | ); |
| | 1749 | } |
| | 1750 | |
| | 1751 | register_setting( 'general', 'siteurl', array( |
| | 1752 | 'show_in_rest' => $siteurl_in_rest, |
| 1747 | 1753 | 'type' => 'string', |
| 1748 | 1754 | 'description' => __( 'Site URL.' ), |
| 1749 | 1755 | ) ); |
diff --git tests/phpunit/tests/rest-api/rest-settings-controller.php tests/phpunit/tests/rest-api/rest-settings-controller.php
index ff91a60..bf30d31 100644
|
|
|
class WP_Test_REST_Settings_Controller extends WP_Test_REST_Controller_Testcase
|
| 50 | 50 | $response = $this->server->dispatch( $request ); |
| 51 | 51 | $data = $response->get_data(); |
| 52 | 52 | |
| | 53 | if ( is_multisite() ) { |
| | 54 | $expected = array( |
| | 55 | 'title', |
| | 56 | 'description', |
| | 57 | 'email', |
| | 58 | 'timezone', |
| | 59 | 'date_format', |
| | 60 | 'time_format', |
| | 61 | 'start_of_week', |
| | 62 | 'language', |
| | 63 | 'use_smilies', |
| | 64 | 'default_category', |
| | 65 | 'default_post_format', |
| | 66 | 'posts_per_page', |
| | 67 | 'default_ping_status', |
| | 68 | 'default_comment_status', |
| | 69 | ); |
| | 70 | } else { |
| | 71 | $expected = array( |
| | 72 | 'title', |
| | 73 | 'description', |
| | 74 | 'url', |
| | 75 | 'email', |
| | 76 | 'timezone', |
| | 77 | 'date_format', |
| | 78 | 'time_format', |
| | 79 | 'start_of_week', |
| | 80 | 'language', |
| | 81 | 'use_smilies', |
| | 82 | 'default_category', |
| | 83 | 'default_post_format', |
| | 84 | 'posts_per_page', |
| | 85 | 'default_ping_status', |
| | 86 | 'default_comment_status', |
| | 87 | ); |
| | 88 | } |
| | 89 | |
| 53 | 90 | $this->assertEquals( 200, $response->get_status() ); |
| 54 | | $this->assertEquals( array( |
| 55 | | 'title', |
| 56 | | 'description', |
| 57 | | 'url', |
| 58 | | 'email', |
| 59 | | 'timezone', |
| 60 | | 'date_format', |
| 61 | | 'time_format', |
| 62 | | 'start_of_week', |
| 63 | | 'language', |
| 64 | | 'use_smilies', |
| 65 | | 'default_category', |
| 66 | | 'default_post_format', |
| 67 | | 'posts_per_page', |
| 68 | | 'default_ping_status', |
| 69 | | 'default_comment_status', |
| 70 | | ), array_keys( $data ) ); |
| | 91 | $this->assertEquals( $expected, array_keys( $data ) ); |
| 71 | 92 | } |
| 72 | 93 | |
| 73 | 94 | public function test_get_item_value_is_cast_to_type() { |