REST API: Add `home_url` to API index to avoid confusion with `site_url`.

Confusion abound, the API index is the generic term `url` to display the `site_url`. New `home` key will display the `home_url` in the index as well.

Fixes #35647.

git-svn-id: https://develop.svn.wordpress.org/trunk@37031 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Rachel Baker 2016-03-17 19:15:57 +00:00
parent 121bbc3b96
commit da45e59bbd
2 changed files with 2 additions and 0 deletions

View File

@ -945,6 +945,7 @@ class WP_REST_Server {
'name' => get_option( 'blogname' ), 'name' => get_option( 'blogname' ),
'description' => get_option( 'blogdescription' ), 'description' => get_option( 'blogdescription' ),
'url' => get_option( 'siteurl' ), 'url' => get_option( 'siteurl' ),
'home' => home_url(),
'namespaces' => array_keys( $this->namespaces ), 'namespaces' => array_keys( $this->namespaces ),
'authentication' => array(), 'authentication' => array(),
'routes' => $this->get_data_for_routes( $this->get_routes(), $request['context'] ), 'routes' => $this->get_data_for_routes( $this->get_routes(), $request['context'] ),

View File

@ -644,6 +644,7 @@ class Tests_REST_Server extends WP_Test_REST_TestCase {
$this->assertArrayHasKey( 'name', $data ); $this->assertArrayHasKey( 'name', $data );
$this->assertArrayHasKey( 'description', $data ); $this->assertArrayHasKey( 'description', $data );
$this->assertArrayHasKey( 'url', $data ); $this->assertArrayHasKey( 'url', $data );
$this->assertArrayHasKey( 'home', $data );
$this->assertArrayHasKey( 'namespaces', $data ); $this->assertArrayHasKey( 'namespaces', $data );
$this->assertArrayHasKey( 'authentication', $data ); $this->assertArrayHasKey( 'authentication', $data );
$this->assertArrayHasKey( 'routes', $data ); $this->assertArrayHasKey( 'routes', $data );