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-attachments-controller.php

    r43681 r43720  
    11151115        $data = $response->get_data();
    11161116        $properties = $data['schema']['properties'];
    1117         $this->assertEquals( 24, count( $properties ) );
     1117        $this->assertEquals( 26, count( $properties ) );
    11181118        $this->assertArrayHasKey( 'author', $properties );
    11191119        $this->assertArrayHasKey( 'alt_text', $properties );
     
    11271127        $this->assertArrayHasKey( 'date', $properties );
    11281128        $this->assertArrayHasKey( 'date_gmt', $properties );
     1129        $this->assertArrayHasKey( 'generated_slug', $properties );
    11291130        $this->assertArrayHasKey( 'guid', $properties );
    11301131        $this->assertArrayHasKey( 'id', $properties );
     
    11381139        $this->assertArrayHasKey( 'post', $properties );
    11391140        $this->assertArrayHasKey( 'ping_status', $properties );
     1141        $this->assertArrayHasKey( 'permalink_template', $properties );
    11401142        $this->assertArrayHasKey( 'status', $properties );
    11411143        $this->assertArrayHasKey( 'slug', $properties );
Note: See TracChangeset for help on using the changeset viewer.