rest_request_parameter_order

Filters the parameter order.

Description

apply_filters( 'rest_request_parameter_order', (array) $order, (WP_REST_Request) $instance ); 

The order affects which parameters are checked when using get_param() and family. This acts similarly to PHP's request_order setting.

Parameters (2)

0. $order (array)
1. $instance (WP_REST_Request)
The request object.

Usage

To run the hook, copy the example below.
  1. $order = apply_filters( 'rest_request_parameter_order', $order, $instance ); 
  2.  
  3. if ( !empty( $order ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the rest_request_parameter_order callback 
  2. function filter_rest_request_parameter_order( $order, $instance ) { 
  3. // make filter magic happen here... 
  4. return $order
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'rest_request_parameter_order', 'filter_rest_request_parameter_order', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'rest_request_parameter_order', 'filter_rest_request_parameter_order', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/rest-api/class-wp-rest-request.php  
  1. return apply_filters( 'rest_request_parameter_order', $order, $this );