Dispatch a Requests hook to a native WordPress action.
Parameters
$hook
stringrequired- Hook name.
$parameters
arrayoptional- Parameters to pass to callbacks.
Default:
array()
Source
public function dispatch( $hook, $parameters = array() ) {
$result = parent::dispatch( $hook, $parameters );
// Handle back-compat actions.
switch ( $hook ) {
case 'curl.before_send':
/** This action is documented in wp-includes/class-wp-http-curl.php */
do_action_ref_array( 'http_api_curl', array( &$parameters[0], $this->request, $this->url ) );
break;
}
/**
* Transforms a native Request hook to a WordPress action.
*
* This action maps Requests internal hook to a native WordPress action.
*
* @see https://github.com/WordPress/Requests/blob/master/docs/hooks.md
*
* @since 4.7.0
*
* @param array $parameters Parameters from Requests internal hook.
* @param array $request Request data in WP_Http format.
* @param string $url URL to request.
*/
do_action_ref_array( "requests-{$hook}", $parameters, $this->request, $this->url ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
return $result;
}
Hooks
- do_action_ref_array( ‘http_api_curl’,
resource $handle ,array $parsed_args ,string $url ) Fires before the cURL request is executed.
- do_action_ref_array( “requests-{$hook}”,
array $parameters ,array $request ,string $url ) Transforms a native Request hook to a WordPress action.
User Contributed Notes
You must log in before being able to contribute a note or feedback.