From 4d00f182dc9cfc35c9f4c085fc180580eec8bf78 Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Wed, 16 Oct 2024 11:12:11 +0200 Subject: [PATCH] Add argument with post ID to the editor.savePost hook --- packages/edit-post/src/store/actions.js | 2 +- packages/editor/src/store/actions.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/edit-post/src/store/actions.js b/packages/edit-post/src/store/actions.js index 1dc0401baf21c3..7ab0a965379be2 100644 --- a/packages/edit-post/src/store/actions.js +++ b/packages/edit-post/src/store/actions.js @@ -481,7 +481,7 @@ export const initializeMetaBoxes = addAction( 'editor.savePost', 'core/edit-post/save-metaboxes', - async ( options ) => { + async ( post, options ) => { if ( ! options.isAutosave && select.hasMetaBoxes() ) { await dispatch.requestMetaBoxUpdates(); } diff --git a/packages/editor/src/store/actions.js b/packages/editor/src/store/actions.js index f8a18fc86e5376..70be70c6293399 100644 --- a/packages/editor/src/store/actions.js +++ b/packages/editor/src/store/actions.js @@ -278,7 +278,11 @@ export const savePost = if ( ! error ) { try { - await doActionAsync( 'editor.savePost', options ); + await doActionAsync( + 'editor.savePost', + { id: previousRecord.id }, + options + ); } catch ( err ) { error = err; }