WP_REST_Request::has_param( string $key )

Checks if a parameter exists in the request.


Description Description

This allows distinguishing between an omitted parameter, and a parameter specifically set to null.


Top ↑

Parameters Parameters

$key

(string) (Required) Parameter name.


Top ↑

Return Return

(bool) True if a param exists for the given key.



Top ↑

Source Source

File: wp-includes/rest-api/class-wp-rest-request.php

	public function has_param( $key ) {
		$order = $this->get_parameter_order();

		foreach ( $order as $type ) {
			if ( array_key_exists( $key, $this->params[ $type ] ) ) {
				return true;
			}
		}

		return false;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
5.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.