diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 4f2c9d1..a6b9e33 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -5520,6 +5520,18 @@ function wp_send_json_error( $value = null, $status_code = null ) {
 		'data'    => $value,
 	);

+	/*
+	 * If no explicit status code was passed and the value is a WP_Error,
+	 * attempt to derive the HTTP status code from the error data.
+	 */
+	if ( null === $status_code && is_wp_error( $value ) ) {
+		$error_data = $value->get_error_data();
+
+		if ( is_array( $error_data ) && isset( $error_data['status'] ) ) {
+			$status_code = (int) $error_data['status'];
+		}
+	}
+
 	wp_send_json( $response, $status_code );
 }
