[wp-trac] [WordPress Trac] #39124: REST API: Post Types Endpoint and `public`

WordPress Trac noreply at wordpress.org
Tue Dec 6 21:50:39 UTC 2016


#39124: REST API: Post Types Endpoint and `public`
----------------------------+-----------------------------
 Reporter:  timmydcrawford  |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  REST API        |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 While doing some testing of the {{{/types}}} endpoint, I came across a
 difference between the new WP REST API endpoint and the WordPress.com API.
 In the WordPress.com API, the call to {{{get_post_types}}} passes
 {{{array( 'public' =>true )}}} as an argument (
 https://github.com/Automattic/jetpack/blob/master/json-endpoints/class
 .wpcom-json-api-list-post-types-endpoint.php#L42 ) - while in
 {{{WP_REST_Post_Types_Controller#get_items()}}} the {{{public}}} attribute
 is not used.

 I chatted with @jnylen0 a bit about this, and we both agree that the
 current implementation aligns well with `show_in_rest`, but I figured it
 would still be worthwhile to open an issue to discuss.  A few options we
 discussed around this were:

 '''Option 1:'''
 Add support, or I suppose "backwards compatibility" for {{{public}}} in
 the post types endpoint and only return non-public post types when
 {{{context=edit}}}

 '''Option 2:'''
 Always use {{{array( 'public' =>true )}}} when grabbing the post types in
 the endpoint.  This ''feels'' too restrictive, but it is the route taken
 in the WordPress.com API

 '''Option 3:'''
 Let it be.  {{{show_in_rest}}} means exactly as the name implies.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39124>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list