diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php
index de09c6c52e..f050cfbaae 100644
a
|
b
|
class WP_REST_Server { |
406 | 406 | return null; |
407 | 407 | } |
408 | 408 | |
409 | | $result = wp_json_encode( $result ); |
| 409 | /** |
| 410 | * Filters whether the result should be json encoded. |
| 411 | * |
| 412 | * Allows disabling json encoding of the result just before sending the response. |
| 413 | * This can be useful if a content type other than application/json should be used to provide the resource. |
| 414 | * For example: |
| 415 | * - text/calendar iCalendar / ics files according to RFC 5545 |
| 416 | * - text/vcard Business Card information RFC 6350 |
| 417 | * - application/pdf PDF file content |
| 418 | * |
| 419 | * The header field must be set in your resource handler by calling header("Content-Type", "...") |
| 420 | * on your response object. |
| 421 | * |
| 422 | * @since 5.3.0 |
| 423 | * |
| 424 | * @param boolean $do_encode Whether the result content should be passed to wp_json_encode() or not. |
| 425 | * Default true |
| 426 | * @param WP_HTTP_Response $result Result to send to the client. Usually a string or object. |
| 427 | * @param WP_REST_Request $request Request used to generate the response. |
| 428 | * @param WP_REST_Server $this Server instance. |
| 429 | */ |
| 430 | $do_json_encode = apply_filters( 'rest_do_json_encode', true, $result, $request, $this ); |
| 431 | if ( $do_json_encode ) { |
| 432 | $result = wp_json_encode( $result ); |
| 433 | } |
410 | 434 | |
411 | 435 | $json_error_message = $this->get_json_last_error(); |
412 | 436 | if ( $json_error_message ) { |