From b88206a61f977f9053405e7c0c0af0deee78d37c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov <sergeybiryukov@git.wordpress.org> Date: Fri, 24 Jan 2025 12:28:26 +0000 Subject: [PATCH] XML-RPC: Correctly pass the `ID` value to `wp_update_post()` in `::mw_editPost()`. Follow-up to [59697]. Props johnbillion. See #62279. git-svn-id: https://develop.svn.wordpress.org/trunk@59699 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-xmlrpc-server.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php index 87d182f5aa..53fc235249 100644 --- a/src/wp-includes/class-wp-xmlrpc-server.php +++ b/src/wp-includes/class-wp-xmlrpc-server.php @@ -6005,9 +6005,11 @@ class wp_xmlrpc_server extends IXR_Server { $post_date_gmt = $postdata['post_date_gmt']; } - // We've got all the data -- post it. - $newpost = compact( - 'post_id', + $newpost = array( + 'ID' => $post_id, + ); + + $newpost += compact( 'post_content', 'post_title', 'post_category', @@ -6028,6 +6030,7 @@ class wp_xmlrpc_server extends IXR_Server { 'page_template' ); + // We've got all the data -- post it. $result = wp_update_post( $newpost, true ); if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $result->get_error_message() );