Make WordPress Core


Ignore:
Timestamp:
10/11/2018 10:24:51 PM (6 years ago)
Author:
danielbachhuber
Message:

REST API: Include permalink_template/generated_slug for Posts

In order for clients to present permalink previews, the REST API must share the computed results of get_sample_permalink(). These two values are now exposed as permalink_template and generated_slug for public, viewable post types, but only for context=edit.

Props danielbachhuber, rahulsprajapati.
Fixes #45017.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/tests/phpunit/tests/rest-api/rest-pages-controller.php

    r43445 r43720  
    526526        $data = $response->get_data();
    527527        $properties = $data['schema']['properties'];
    528         $this->assertEquals( 22, count( $properties ) );
     528        $this->assertEquals( 24, count( $properties ) );
    529529        $this->assertArrayHasKey( 'author', $properties );
    530530        $this->assertArrayHasKey( 'comment_status', $properties );
     
    532532        $this->assertArrayHasKey( 'date', $properties );
    533533        $this->assertArrayHasKey( 'date_gmt', $properties );
     534        $this->assertArrayHasKey( 'generated_slug', $properties );
    534535        $this->assertArrayHasKey( 'guid', $properties );
    535536        $this->assertArrayHasKey( 'excerpt', $properties );
     
    543544        $this->assertArrayHasKey( 'parent', $properties );
    544545        $this->assertArrayHasKey( 'password', $properties );
     546        $this->assertArrayHasKey( 'permalink_template', $properties );
    545547        $this->assertArrayHasKey( 'ping_status', $properties );
    546548        $this->assertArrayHasKey( 'slug', $properties );
Note: See TracChangeset for help on using the changeset viewer.