WP_REST_Request::offsetExists()publicWP 4.4.0ReturnTypeWillChange

Checks if a parameter is set.

Method of the class: WP_REST_Request{}

No Hooks.

Return

true|false. Whether the parameter is set.

Usage

$WP_REST_Request = new WP_REST_Request();
$WP_REST_Request->offsetExists( $offset );
$offset(string) (required)
Parameter name.

Changelog

Since 4.4.0 Introduced.

WP_REST_Request::offsetExists() code WP 6.4.3

public function offsetExists( $offset ) {
	$order = $this->get_parameter_order();

	foreach ( $order as $type ) {
		if ( isset( $this->params[ $type ][ $offset ] ) ) {
			return true;
		}
	}

	return false;
}