WP_Http::post()publicWP 2.7.0

Uses the POST HTTP method.

Used for sending data that is expected to be in the body.

Method of the class: WP_Http{}

No Hooks.


Array|WP_Error. Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error.


$WP_Http = new WP_Http();
$WP_Http->post( $url, $args );
$url(string) (required)
The request URL.
Override the defaults.
Default: array()


Since 2.7.0 Introduced.

WP_Http::post() code WP 6.4.1

public function post( $url, $args = array() ) {
	$defaults    = array( 'method' => 'POST' );
	$parsed_args = wp_parse_args( $args, $defaults );
	return $this->request( $url, $parsed_args );