Make WordPress Core

Opened 4 years ago

Closed 2 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 2 years ago.
Initial patch
48638-1.diff (892 bytes) - added by johnregan3 2 years ago.
Updated documentation.

Download all attachments as: .zip

Change History (12)

#1 @spacedmonkey
2 years ago

  • Keywords good-first-bug added

@johnregan3
2 years ago

Initial patch

#2 follow-up: @spacedmonkey
2 years ago

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

#3 in reply to: ↑ 2 @johnregan3
2 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
2 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
2 years ago

Updated documentation.

#5 @johnregan3
2 years ago

@hasanuzzamanshamim Thanks for the feedback! Patch updated.

#6 @johnregan3
2 years ago

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

#7 @spacedmonkey
2 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
2 years ago

@TimothyBlynJacobs Are you happy for me to commit this?

#9 @TimothyBlynJacobs
2 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
2 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.