WordPress at a glance
функция не описана

wp_safe_remote_post() WP 3.6.0

Retrieve the raw response from a safe HTTP request using the POST method.

This function is ideal when the HTTP request is being made to an arbitrary URL. The URL is validated to avoid redirection and request forgery attacks.

Хуков нет.

Возвращает

Array/WP_Error. The response or WP_Error on failure.

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

wp_safe_remote_post( $url, $args );
$url(string) (required)
URL to retrieve.
$args(array)
Request arguments.
Default: empty array

Заметки

  • See: wp_remote_request() For more information on the response array format.
  • See: WP_Http::request() For default arguments information.

Changelog

Since 3.6.0 Introduced.

Код wp_safe_remote_post() WP 5.5.1

<?php
function wp_safe_remote_post( $url, $args = array() ) {
	$args['reject_unsafe_urls'] = true;
	$http                       = _wp_http_get_object();
	return $http->post( $url, $args );
}