diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php index 14a8843e4f..601717e7e8 100644 --- a/src/wp-includes/class-wp-xmlrpc-server.php +++ b/src/wp-includes/class-wp-xmlrpc-server.php @@ -6434,9 +6434,10 @@ class wp_xmlrpc_server extends IXR_Server { $upload = wp_upload_bits( $name, null, $bits ); if ( ! empty( $upload['error'] ) ) { /* translators: 1: File name, 2: Error message. */ - $errorString = sprintf( __( 'Could not write file %1$s (%2$s).' ), $name, $upload['error'] ); - return new IXR_Error( 500, $errorString ); + $error_string = sprintf( __( 'Could not write file %1$s (%2$s).' ), $name, $upload['error'] ); + return new IXR_Error( 500, $error_string ); } + // Construct the attachment array. $post_id = 0; if ( ! empty( $data['post_id'] ) ) { @@ -6446,6 +6447,7 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); } } + $attachment = array( 'post_title' => $name, 'post_content' => '',