From b59bac3e7731052f724039b101ae1e4009d33cc6 Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Wed, 16 Oct 2024 12:39:19 +0200 Subject: [PATCH] Add argument with post ID to the editor.savePost hook (#66165) Co-authored-by: jsnajdr Co-authored-by: tyxla --- 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 d73b4aac2eee36..1a6a01471a39b9 100644 --- a/packages/editor/src/store/actions.js +++ b/packages/editor/src/store/actions.js @@ -255,7 +255,11 @@ export const savePost = if ( ! error ) { try { - await doActionAsync( 'editor.savePost', options ); + await doActionAsync( + 'editor.savePost', + { id: previousRecord.id }, + options + ); } catch ( err ) { error = err; }