[wp-trac] [WordPress Trac] #38701: Remove rest_get_post filter
WordPress Trac
noreply at wordpress.org
Tue Nov 8 01:58:14 UTC 2016
#38701: Remove rest_get_post filter
--------------------------+-----------------------
Reporter: rmccue | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.7
Component: REST API | Version: trunk
Severity: normal | Keywords: has-patch
Focuses: |
--------------------------+-----------------------
This filter was originally introduced in [https://github.com/WP-API/WP-
API/pull/2535 GH#2535] to support Customizer Changesets (née
Transactions). This is a super broad filter and doesn't really fit with
the design of the API, nor is it (arguably) the right level to do this.
#12955 covers the addition of a new `get_post` filter, which would enable
this at the lower level more nicely. I
[https://wordpress.slack.com/archives/core-restapi/p1478568033001007 spoke
to @westonruter in #core-restapi], and we agreed that the lower level
filter is a better place for it.
The existing filters almost entirely cover the use-case, with `the_post`
called in `setup_postdata`, which is called in the preparation method. The
exception is the post status and post parent checks in the permission
checks.
We can instead update these to use the wrapper functions in core:
`get_post_status` and `wp_get_post_parent_id()`. The former is filterable,
the latter currently isn't, but can be changed.
This needs to be in 4.7, as the filter is new in trunk.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38701>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list