wppaste
WordPress

WP_HTTP_Requests_Hooks::dispatch( string $hook, array $parameters = array() ): bool

Source
wp-includes/class-wp-http-requests-hooks.php:51
Dispatch a Requests hook to a native WordPress action.

Parameters

$hookstring
Hook name.
$parametersarrayoptional
Parameters to pass to callbacks.Default: array()

Return

bool
True if hooks were run, false if nothing was hooked.

Hooks fired · 2

2 hooks fire while WP_HTTP_Requests_Hooks::dispatch() runs, in this order:

  1. do_action( http_api_curl )actionline 58 (+7 into the body)

    Fires before the cURL request is executed.

  2. do_action( requests-{$hook} )actionline 75 (+24 into the body)

    Transforms a native Request hook to a WordPress action.

Uses · 2

  • do_action_ref_array()Calls the callback functions that have been added to an action hook, specifying arguments in an array.
  • \WpOrg\Requests\Hooks::dispatch()

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;	}

History

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/class-wp-http-requests-hooks.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.