Opened 8 years ago
Closed 8 years ago
#38701 closed defect (bug) (fixed)
Remove rest_get_post filter
Reported by: | rmccue | Owned by: | joehoyle |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | REST API | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
This filter was originally introduced in 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 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.
Remove rest_get_post, and use accessor functions for filterability