WP_Http::browser_redirect_compatibility()public staticWP 4.6.0

Match redirect behavior to browser handling.

Changes 302 redirects from POST to GET to match browser handling. Per RFC 7231, user agents can deviate from the strict reading of the specification for compatibility purposes.

Method of the class: WP_Http{}

No Hooks.


null. Ничего (null).


$result = WP_Http::browser_redirect_compatibility( $location, $headers, $data, $options, $original );
$location(string) (required)
URL to redirect to.
$headers(array) (required)
Headers for the redirect.
$data(string|array) (required)
Body to send with the request.
$options(array) (required) (passed by reference — &)
Redirect request options.
$original(WpOrg\Requests\Response) (required)
Response object.


Since 4.6.0 Introduced.

WP_Http::browser_redirect_compatibility() code WP 6.4.1

public static function browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) {
	// Browser compatibility.
	if ( 302 === $original->status_code ) {
		$options['type'] = WpOrg\Requests\Requests::GET;