Filter hook 'rest_request_parameter_order'

in WP Core File wp-includes/rest-api/class-wp-rest-request.php at line 397

View Source

rest_request_parameter_order

Filter Hook
Description
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.

Hook Information

File Location wp-includes/rest-api/class-wp-rest-request.php View on GitHub
Hook Type Filter
Line Number 397

Hook Parameters

Type Name Description
string[] $order Array of types to check, in order of priority.
WP_REST_Request $request The request object.

Usage Examples

Basic Usage
<?php
// Hook into rest_request_parameter_order
add_filter('rest_request_parameter_order', 'my_custom_filter', 10, 2);

function my_custom_filter($order, $request) {
    // Your custom filtering logic here
    return $order;
}

Source Code Context

wp-includes/rest-api/class-wp-rest-request.php:397 - How this hook is used in WordPress core
<?php
 392  		 * @since 4.4.0
 393  		 *
 394  		 * @param string[]        $order   Array of types to check, in order of priority.
 395  		 * @param WP_REST_Request $request The request object.
 396  		 */
 397  		return apply_filters( 'rest_request_parameter_order', $order, $this );
 398  	}
 399  
 400  	/**
 401  	 * Retrieves a parameter from the request.
 402  	 *

PHP Documentation

<?php
/**
		 * 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.
		 *
		 * @since 4.4.0
		 *
		 * @param string[]        $order   Array of types to check, in order of priority.
		 * @param WP_REST_Request $request The request object.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/rest-api/class-wp-rest-request.php
Related Hooks

Related hooks will be displayed here in future updates.