rest_request_parameter_order filter-hookWP 4.4.0

Filters the parameter priority order for a REST API request.

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

Usage

add_filter( 'rest_request_parameter_order', 'wp_kama_rest_request_parameter_order_filter', 10, 2 );

/**
 * Function for `rest_request_parameter_order` filter-hook.
 * 
 * @param string[]        $order   Array of types to check, in order of priority.
 * @param WP_REST_Request $request The request object.
 *
 * @return string[]
 */
function wp_kama_rest_request_parameter_order_filter( $order, $request ){

	// filter...
	return $order;
}
$order(string[])
Array of types to check, in order of priority.
$request(WP_REST_Request)
The request object.

Changelog

Since 4.4.0 Introduced.

Where the hook is called

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

Where the hook is used in WordPress

Usage not found.