[wp-trac] [WordPress Trac] #45017: REST API: Expose permalink_template in the Posts controller

WordPress Trac noreply at wordpress.org
Wed Oct 3 21:30:26 UTC 2018


#45017: REST API: Expose permalink_template in the Posts controller
------------------------------------------+-----------------------
 Reporter:  danielbachhuber               |       Owner:  (none)
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  5.0
Component:  REST API                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  rest-api
------------------------------------------+-----------------------

Comment (by danielbachhuber):

 @rahulsprajapati Looking pretty good!

 One last suggestion: it'd be great to have a test that registered a non-
 public custom post type and asserted neither `permalink_template` nor
 `generated_slug` were on the schema and in the Post response.

 My hunch is that, with 45017.2.diff, `permalink_template` and
 `generated_slug` will be included on the Post response accidentally
 because they aren't defined in the schema. We'll need to apply the `if (
 is_post_type_viewable( $post_type_obj ) && $post_type_obj->public  ) {`
 conditional in `prepare_item_for_response()` too.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45017#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list