rest_json_encode_options filter-hookWP 6.1.0

Filters the JSON encoding options used to send the REST API response.

Usage

add_filter( 'rest_json_encode_options', 'wp_kama_rest_json_encode_options_filter', 10, 2 );

/**
 * Function for `rest_json_encode_options` filter-hook.
 * 
 * @param int             $options JSON encoding options {@see json_encode()}.
 * @param WP_REST_Request $request Current request object.
 *
 * @return int
 */
function wp_kama_rest_json_encode_options_filter( $options, $request ){

	// filter...
	return $options;
}
$options(int)
JSON encoding options {@see json_encode()}.
$request(WP_REST_Request)
Current request object.

Changelog

Since 6.1.0 Introduced.

Where the hook is called

WP_REST_Server::get_json_encode_options()
rest_json_encode_options
wp-includes/rest-api/class-wp-rest-server.php 266
return apply_filters( 'rest_json_encode_options', $options, $request );

Where the hook is used in WordPress

Usage not found.