rest_parse_request_arg

Advertisement

Summery Summery

Parse a request argument based on details registered to the route.

Syntax Syntax

rest_parse_request_arg( mixed $value, WP_REST_Request $request, string $param )

Description Description

Runs a validation check and sanitizes the value, primarily to be used via the sanitize_callback arguments in the endpoint args registration.

Parameters Parameters

$value

(Required)

$request

(Required)

$param

(Required)

Return Return

(mixed)

Source Source

File: wp-includes/rest-api.php

 * @since 4.4.0
 *
 * @param string $date      RFC3339 timestamp.
 * @param bool   $force_utc Optional. Whether to force UTC timezone instead of using
 *                          the timestamp's timezone. Default false.
 * @return int Unix timestamp.
 */
function rest_parse_date( $date, $force_utc = false ) {
	if ( $force_utc ) {
		$date = preg_replace( '/[+-]\d+:?\d+$/', '+00:00', $date );
	}

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

Advertisement

Leave a Reply