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

WordPress Trac noreply at wordpress.org
Thu Oct 4 05:38:20 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:  has-patch needs-refresh has-unit-    |     Focuses:  rest-api
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by rahulsprajapati):

 * keywords:  needs-patch needs-unit-tests => has-patch needs-refresh has-
     unit-tests


Comment:

 Replying to [comment:6 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.

 Yeah, that is possible - will update this changes soon.

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


More information about the wp-trac mailing list