Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#48638 closed enhancement (fixed)

Pass WP_REST_Request object to the rest_index filter

Reported by: timothyblynjacobs's profile TimothyBlynJacobs Owned by: spacedmonkey's profile spacedmonkey
Milestone: 6.0 Priority: normal
Severity: normal Version: 4.4
Component: REST API Keywords: good-first-bug has-patch commit
Focuses: Cc:

Description

The rest_index filter does not have access to the WP_REST_Request object which means we can't easily modify the response depending on the request data provided.

Attachments (2)

48638.diff (567 bytes) - added by johnregan3 3 years ago.
Initial patch
48638-1.diff (892 bytes) - added by johnregan3 3 years ago.
Updated documentation.

Download all attachments as: .zip

Change History (12)

#1 @spacedmonkey
3 years ago

  • Keywords good-first-bug added

@johnregan3
3 years ago

Initial patch

#2 follow-up: @spacedmonkey
3 years ago

@johnregan3 Thanks for the patch! Any chance you could also update the comment on the filter?

#3 in reply to: ↑ 2 @johnregan3
3 years ago

Replying to spacedmonkey:

@johnregan3 Thanks for the patch! Any chance you could also update the comment on the filter?

@spacedmonkey Gladly. What would you like me to add? Documentation in the long description?

#4 @hasanuzzamanshamim
3 years ago

Patch looks good from my side, I think updating the long description of filter hook and a since tag with new params will be perfect.

https://prnt.sc/26qf7p3

@johnregan3
3 years ago

Updated documentation.

#5 @johnregan3
3 years ago

@hasanuzzamanshamim Thanks for the feedback! Patch updated.

#6 @johnregan3
3 years ago

Polite bump notifying @spacedmonkey as they're the component maintainer.

#7 @spacedmonkey
3 years ago

  • Keywords has-patch commit added; needs-patch removed
  • Milestone changed from Awaiting Review to 6.0
  • Owner set to spacedmonkey
  • Status changed from new to assigned

#8 @spacedmonkey
3 years ago

@TimothyBlynJacobs Are you happy for me to commit this?

#9 @TimothyBlynJacobs
3 years ago

@spacedmonkey Go for it!

We can remove this comment: Additionally, the Request is included so the Response can be modified based on input provided by the client.

#10 @spacedmonkey
3 years ago

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

In 52796:

REST API: Pass WP_REST_Request object to the rest_index filter.

Props johnregan3, TimothyBlynJacobs, Spacedmonkey, hasanuzzamanshamim.
Fixes #48638.

Note: See TracTickets for help on using tickets.