Make WordPress Core

Opened 4 years ago

Closed 15 months 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:


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

Download all attachments as: .zip

Change History (12)

#1 @spacedmonkey
18 months ago

  • Keywords good-first-bug added

18 months ago

Initial patch

#2 follow-up: @spacedmonkey
18 months ago

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

#3 in reply to: ↑ 2 @johnregan3
18 months 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
16 months 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.

16 months ago

Updated documentation.

#5 @johnregan3
16 months ago

@hasanuzzamanshamim Thanks for the feedback! Patch updated.

#6 @johnregan3
15 months ago

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

#7 @spacedmonkey
15 months 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
15 months ago

@TimothyBlynJacobs Are you happy for me to commit this?

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