WP_HTTP_Response::__construct() WordPress Method

The WP_HTTP_Response::__construct() function is used to construct an HTTP response object. This function takes two arguments: a code and an array of headers. The code argument is the HTTP response code, while the array of headers is an associative array of header names and values.

WP_HTTP_Response::__construct( mixed $data = null, int $status = 200, array $headers = array() ) #

Constructor.


Parameters

$data

(mixed)(Optional)Response data.

Default value: null

$status

(int)(Optional) HTTP status code.

Default value: 200

$headers

(array)(Optional) HTTP header map.

Default value: array()


Top ↑

Source

File: wp-includes/class-wp-http-response.php

	public function __construct( $data = null, $status = 200, $headers = array() ) {
		$this->set_data( $data );
		$this->set_status( $status );
		$this->set_headers( $headers );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.