Title: WP_REST_Request::has_param
Published: November 12, 2019
Last modified: August 20, 2026

---

# WP_REST_Request::has_param( string $key ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#changelog)

Checks if a parameter exists in the request.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#description)󠁿

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#parameters)󠁿

 `$key`stringrequired

Parameter name.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#return)󠁿

 bool True if a param exists for the given key.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#source)󠁿

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

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

    	return false;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/class-wp-rest-request.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/rest-api/class-wp-rest-request.php#L432)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/rest-api/class-wp-rest-request.php#L432-L442)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_REST_Request::get_parameter_order()](https://developer.wordpress.org/reference/classes/wp_rest_request/get_parameter_order/)`wp-includes/rest-api/class-wp-rest-request.php` |

Retrieves the parameter priority order.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_request/has_param/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_request%2Fhas_param%2F)
before being able to contribute a note or feedback.