Retrieves the parameter priority order.
Description
Used when checking parameters in WP_REST_Request::get_param().
Source
return isset( $content_type['value'] ) && wp_is_json_media_type( $content_type['value'] );
}
/**
* Retrieves the parameter priority order.
*
* Used when checking parameters in WP_REST_Request::get_param().
*
* @since 4.4.0
*
* @return string[] Array of types to check, in order of priority.
*/
protected function get_parameter_order() {
$order = array();
if ( $this->is_json_content_type() ) {
$order[] = 'JSON';
}
$this->parse_json_params();
// Ensure we parse the body data.
$body = $this->get_body();
if ( 'POST' !== $this->method && ! empty( $body ) ) {
$this->parse_body_params();
}
$accepts_body_data = array( 'POST', 'PUT', 'PATCH', 'DELETE' );
if ( in_array( $this->method, $accepts_body_data, true ) ) {
$order[] = 'POST';
}
$order[] = 'GET';
$order[] = 'URL';
$order[] = 'defaults';
/**
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.