rest_handle_options_request

Advertisement

Summery Summery

Handles OPTIONS requests for the server.

Syntax Syntax

rest_handle_options_request( mixed $response, WP_REST_Server $handler, WP_REST_Request $request )

Description Description

This is handled outside of the server code, as it doesn’t obey normal route mapping.

Parameters Parameters

$response

(mixed) (Required) Current response, either response or null to indicate pass-through.

$handler

(WP_REST_Server) (Required) ResponseHandler instance (usually WP_REST_Server).

$request

(WP_REST_Request) (Required) The request that was used to make current response.

Return Return

(WP_REST_Response) Modified response, either response or null to indicate pass-through.

Source Source

File: wp-includes/rest-api.php

	header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) );
}

/**
 * Handles _doing_it_wrong errors.
 *
 * @since 5.5.0
 *
 * @param string      $function The function that was called.
 * @param string      $message  A message explaining what has been done incorrectly.
 * @param string|null $version  The version of WordPress where the message was added.
 */
function rest_handle_doing_it_wrong( $function, $message, $version ) {
	if ( ! WP_DEBUG || headers_sent() ) {
		return;
	}

	if ( $version ) {
		/* translators: Developer debugging message. 1: PHP function name, 2: WordPress version number, 3: Explanatory message. */
		$string = __( '%1$s (since %2$s; %3$s)' );
		$string = sprintf( $string, $function, $version, $message );
	} else {
		/* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message. */
		$string = __( '%1$s (%2$s)' );
		$string = sprintf( $string, $function, $message );
	}

	header( sprintf( 'X-WP-DoingItWrong: %s', $string ) );
}

/**
 * Sends Cross-Origin Resource Sharing headers with API requests.
 *
 * @since 4.4.0
 *
 * @param mixed $value Response data.
 * @return mixed Response data.
 */

Advertisement

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.