diff --git a/wp-includes/rest-api/class-wp-rest-server.php b/wp-includes/rest-api/class-wp-rest-server.php index 68be073eef..7f158959e9 100644 --- a/wp-includes/rest-api/class-wp-rest-server.php +++ b/wp-includes/rest-api/class-wp-rest-server.php @@ -405,6 +405,11 @@ class WP_REST_Server { */ $result = apply_filters( 'rest_pre_echo_response', $result, $this, $request ); + // The 204 response shouldn't have a body. + if ( 204 === $code || null === $result ) { + return null; + } + $result = wp_json_encode( $result ); $json_error_message = $this->get_json_last_error(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 3d4fc6d0fe..89c22e19d5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45808'; +$wp_version = '5.3-alpha-45809'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.