WP_REST_Abilities_V1_Run_Controller::get_input_from_request( WP_REST_Request $request ): mixed|null

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Extracts input parameters from the request.

Parameters

$requestWP_REST_Requestrequired
The request object.

Return

mixed|null The input parameters.

Source

private function get_input_from_request( $request ) {
	if ( in_array( $request->get_method(), array( 'GET', 'DELETE' ), true ) ) {
		// For GET and DELETE requests, look for 'input' query parameter.
		$query_params = $request->get_query_params();
		return $query_params['input'] ?? null;
	}

	// For POST requests, look for 'input' in JSON body.
	$json_params = $request->get_json_params();
	return $json_params['input'] ?? null;
}

Changelog

VersionDescription
6.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.