Skip to content

Commit

Permalink
XML-RPC: Correctly pass the ID value to wp_update_post() in `::mw…
Browse files Browse the repository at this point in the history
…_editPost()`.

Follow-up to [59697].

Props johnbillion.
See #62279.

git-svn-id: https://develop.svn.wordpress.org/trunk@59699 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Jan 24, 2025
1 parent 0f6707d commit b88206a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/wp-includes/class-wp-xmlrpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -6005,9 +6005,11 @@ public function mw_editPost( $args ) {
$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',
Expand All @@ -6028,6 +6030,7 @@ public function mw_editPost( $args ) {
'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() );
Expand Down

0 comments on commit b88206a

Please sign in to comment.