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.

Метод класса: WP_Http{}

Хуков нет.

Возвращает

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

Использование

$result = WP_Http::browser_redirect_compatibility( $location, $headers, $data, $options, $original );
$location(строка) (обязательный)
URL to redirect to.
$headers(массив) (обязательный)
Headers for the redirect.
$data(строка|массив) (обязательный)
Body to send with the request.
$options(массив) (обязательный) (передается по ссылке — &)
Redirect request options.
$original(WpOrg\Requests\Response) (обязательный)
Response object.

Список изменений

С версии 4.6.0 Введена.

Код WP_Http::browser_redirect_compatibility() WP 6.4.3

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