Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $type parameter to ep_do_intercept_request filter #2443

Merged
merged 2 commits into from
Nov 5, 2021
Merged

Add $type parameter to ep_do_intercept_request filter #2443

merged 2 commits into from
Nov 5, 2021

Conversation

rebeccahum
Copy link
Contributor

@rebeccahum rebeccahum commented Nov 5, 2021

Description of the Change

It would be nice if we could pass in the $type parameter into the ep_do_intercept_request filter:

* @param string $type Type of request, used for debugging.
*
* @return WP_Error|array The response or WP_Error on failure.
*/
public function remote_request( $path, $args = [], $query_args = [], $type = null ) {

This way, we have the flexibility of intercepting the request based on the type of request.

Alternate Designs

N/A.

Benefits

We would be able to intercept the request based on the type of request.

Possible Drawbacks

Those hooking onto the filter already may need to update their filter arguments

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Changed: Add $type parameter to ep_do_intercept_request filter

@felipeelia
Copy link
Member

hey @rebeccahum, thanks for the PR! Do you mind updating the doc block to the following? (just adding the @since info there)

/**
 * Filter intercepted request
 *
 * @hook ep_do_intercept_request
 * @since 3.2.2
 * @since 4.0.0 added $type
 * @param {array} $request New remote request response
 * @param  {array} $query Remote request arguments
 * @param  {args} $args Request arguments
 * @param  {int} $failures Number of failures
 * @param  {string} $type Type of request
 * @return {array} New request
 */

@rebeccahum
Copy link
Contributor Author

@felipeelia done

@felipeelia felipeelia merged commit e623992 into 10up:develop Nov 5, 2021
@rebeccahum rebeccahum deleted the add/type-to-ep_do_intercept_request branch November 5, 2021 20:55
@felipeelia felipeelia added this to the 3.6.5 milestone Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants