WP_REST_Request::get_param() public WP 4.4.0
Retrieves a parameter from the request.
{} It's a method of the class: WP_REST_Request{}
No Hooks.
Return
Mixed/null. Value if set, null otherwise.
Usage
$WP_REST_Request = new WP_REST_Request(); $WP_REST_Request->get_param( $key );
- $key(string) (required)
- Parameter name.
Changelog
Since 4.4.0 | Introduced. |
Code of WP_REST_Request::get_param() WP REST Request::get param WP 5.6
public function get_param( $key ) {
$order = $this->get_parameter_order();
foreach ( $order as $type ) {
// Determine if we have the parameter for this type.
if ( isset( $this->params[ $type ][ $key ] ) ) {
return $this->params[ $type ][ $key ];
}
}
return null;
}