WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_REST_Request::parse_body_params() WP 4.4.0

Parses the request body parameters.

Parses out URL-encoded bodies for request methods that aren't supported natively by PHP. In PHP 5.x, only POST has these parsed automatically.

Это метод класса: WP_REST_Request

Хуков нет.

Возвращает

Null. Ничего.

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

$WP_REST_Request = new WP_REST_Request();
$var = $WP_REST_Request->parse_body_params();

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

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

Код WP REST Request::parse body params: wp-includes/rest-api/class-wp-rest-request.php WP 5.2.2

<?php
protected function parse_body_params() {
	if ( $this->parsed_body ) {
		return;
	}

	$this->parsed_body = true;

	/*
	 * Check that we got URL-encoded. Treat a missing content-type as
	 * URL-encoded for maximum compatibility.
	 */
	$content_type = $this->get_content_type();

	if ( ! empty( $content_type ) && 'application/x-www-form-urlencoded' !== $content_type['value'] ) {
		return;
	}

	parse_str( $this->get_body(), $params );

	/*
	 * Amazingly, parse_str follows magic quote rules. Sigh.
	 *
	 * NOTE: Do not refactor to use `wp_unslash`.
	 */
	if ( get_magic_quotes_gpc() ) {
		$params = stripslashes_deep( $params );
	}

	/*
	 * Add to the POST parameters stored internally. If a user has already
	 * set these manually (via `set_body_params`), don't override them.
	 */
	$this->params['POST'] = array_merge( $params, $this->params['POST'] );
}