rest_json_encode_options хук-фильтрWP 6.1.0

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

Использование

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.

Список изменений

С версии 6.1.0 Введена.

Где вызывается хук

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 );

Где используется хук в WordPress

Использование не найдено.