[wp-trac] [WordPress Trac] #39124: REST API: Post Types Endpoint and `public`
WordPress Trac
noreply at wordpress.org
Thu Dec 29 04:38:24 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: 4.7
Severity: normal | Resolution:
Keywords: close | Focuses:
----------------------------+------------------------------
Changes (by rachelbaker):
* keywords: => close
Comment:
@timmydcrawford The problem with using an existing property, like
`public`, is that when themes or plugin developers registered their
post_type following the documentation
(https://developer.wordpress.org/reference/functions/register_post_type/#parameters)
they had no way of knowing the full implications of their selected
`true|false` value. This is especially true of any post_type that was
registered before December 2016.
This is even more complex when you look at a property like `public` which
has implications for both the front-end and back-end of a site. I can set
`public` to `true` as a lazy way of setting `show_ui` and `show_in_menu`
to `true` and then explicitly set `publicly_queryable` to `false` and
`exclude_from_search` to `false`. #WordPress :( I am surprised the
WordPress.com API chose this approach, but always being behind
authentication allows for more reckless behavior.
Our challenge was how can we allow make sure existing sites/themes/plugins
AND new sites/themes/plugins intend to expose data in the public API. We
decided to add the `show_in_rest` property to the `WP_Post_Type` object so
there would be no confusion. If you set `show_in_rest` to true, then the
post_type is available from the `/types` endpoint and we register the post
type endpoints (based on the `rest_base` property) for you.
My vote is for option 3.
> Option 3:
> Let it be. show_in_rest means exactly as the name implies.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39124#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list