Make WordPress Core


Ignore:
Timestamp:
12/12/2018 02:11:22 AM (6 years ago)
Author:
jeremyfelt
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.

Merges [43720] to trunk.

Props danielbachhuber, rahulsprajapati.
Fixes #45017.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php

    r43973 r43980  
    12961296        $data       = $response->get_data();
    12971297        $properties = $data['schema']['properties'];
    1298         $this->assertEquals( 24, count( $properties ) );
     1298        $this->assertEquals( 26, count( $properties ) );
    12991299        $this->assertArrayHasKey( 'author', $properties );
    13001300        $this->assertArrayHasKey( 'alt_text', $properties );
     
    13081308        $this->assertArrayHasKey( 'date', $properties );
    13091309        $this->assertArrayHasKey( 'date_gmt', $properties );
     1310        $this->assertArrayHasKey( 'generated_slug', $properties );
    13101311        $this->assertArrayHasKey( 'guid', $properties );
    13111312        $this->assertArrayHasKey( 'id', $properties );
     
    13191320        $this->assertArrayHasKey( 'post', $properties );
    13201321        $this->assertArrayHasKey( 'ping_status', $properties );
     1322        $this->assertArrayHasKey( 'permalink_template', $properties );
    13211323        $this->assertArrayHasKey( 'status', $properties );
    13221324        $this->assertArrayHasKey( 'slug', $properties );
Note: See TracChangeset for help on using the changeset viewer.