W3cubDocs

/WordPress

WP_HTTP_Requests_Response::to_array(): array

Converts the object to a WP_Http response array.

Return

array WP_Http response array, per WP_Http::request().

Source

public function to_array() {
	return array(
		'headers'  => $this->get_headers(),
		'body'     => $this->get_data(),
		'response' => array(
			'code'    => $this->get_status(),
			'message' => get_status_header_desc( $this->get_status() ),
		),
		'cookies'  => $this->get_cookies(),
		'filename' => $this->filename,
	);
}

Changelog

Version Description
4.6.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_http_requests_response/to_array