Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#38701 closed defect (bug) (fixed)

Remove rest_get_post filter

Reported by: rmccue's profile rmccue Owned by: joehoyle's profile 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.

Attachments (3)

38701.diff (15.6 KB) - added by rmccue 8 years ago.
Remove rest_get_post, and use accessor functions for filterability
38701.2.diff (16.9 KB) - added by rmccue 8 years ago.
Remove old unit tests
38701.3.diff (13.4 KB) - added by rmccue 8 years ago.
Remove accessor functions

Download all attachments as: .zip

Change History (6)

@rmccue
8 years ago

Remove rest_get_post, and use accessor functions for filterability

@rmccue
8 years ago

Remove old unit tests

@rmccue
8 years ago

Remove accessor functions

#1 @rmccue
8 years ago

Per Slack, attached patch doesn't add the accessor functions. This has been split to #38702 for 4.8 instead.

#2 @rmccue
8 years ago

  • Keywords commit added
  • Owner set to joehoyle
  • Status changed from new to assigned

Assigning to Joe for review and commit.

#3 @joehoyle
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 39161:

REST API: Remove rest_get_post filter and get_post abstraction.

This filter was originally introduced in https://github.com/WP-API/WP-API/pull/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.

Props rmccue.
Fixes #38701.

Note: See TracTickets for help on using tickets.