REST API: Add `permalink_structure` to the index endpoint.

This allows Gutenberg to implement permalink editing.

Props schlessera.
Fixes #42465.



git-svn-id: https://develop.svn.wordpress.org/trunk@42142 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2017-11-10 06:10:23 +00:00
parent d7af48d421
commit 58fad5bf57
3 changed files with 12 additions and 9 deletions

View File

@ -1023,6 +1023,7 @@ class WP_REST_Server {
'home' => home_url(),
'gmt_offset' => get_option( 'gmt_offset' ),
'timezone_string' => get_option( 'timezone_string' ),
'permalink_structure' => get_option( 'permalink_structure' ),
'namespaces' => array_keys( $this->namespaces ),
'authentication' => array(),
'routes' => $this->get_data_for_routes( $this->get_routes(), $request['context'] ),

View File

@ -665,6 +665,7 @@ class Tests_REST_Server extends WP_Test_REST_TestCase {
$this->assertArrayHasKey( 'home', $data );
$this->assertArrayHasKey( 'gmt_offset', $data );
$this->assertArrayHasKey( 'timezone_string', $data );
$this->assertArrayHasKey( 'permalink_structure', $data );
$this->assertArrayHasKey( 'namespaces', $data );
$this->assertArrayHasKey( 'authentication', $data );
$this->assertArrayHasKey( 'routes', $data );

View File

@ -12,6 +12,7 @@ mockedApiResponse.Schema = {
"home": "http://example.org",
"gmt_offset": "0",
"timezone_string": "",
"permalink_structure": false,
"namespaces": [
"oembed/1.0",
"wp/v2"