Make WordPress Core


Ignore:
Timestamp:
11/10/2016 02:20:09 AM (8 years ago)
Author:
joehoyle
Message:

REST API: Add rest_base to response objects of wp/v2/taxonomies and wp/v2/types

Though we have the _links.collection available, having this value can be useful to know post type / taxonomy urls if you need to build them another way.

Props youknowriad, jnylen0.
Fixes #38607.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php

    r39097 r39191  
    120120        $data = $response->get_data();
    121121        $properties = $data['schema']['properties'];
    122         $this->assertEquals( 7, count( $properties ) );
     122        $this->assertEquals( 8, count( $properties ) );
    123123        $this->assertArrayHasKey( 'capabilities', $properties );
    124124        $this->assertArrayHasKey( 'description', $properties );
     
    128128        $this->assertArrayHasKey( 'slug', $properties );
    129129        $this->assertArrayHasKey( 'taxonomies', $properties );
     130        $this->assertArrayHasKey( 'rest_base', $properties );
    130131    }
    131132
     
    171172        $this->assertEquals( $post_type_obj->description, $data['description'] );
    172173        $this->assertEquals( $post_type_obj->hierarchical, $data['hierarchical'] );
     174        $this->assertEquals( $post_type_obj->rest_base, $data['rest_base'] );
    173175
    174176        $links = test_rest_expand_compact_links( $links );
Note: See TracChangeset for help on using the changeset viewer.