diff --git a/js/customize-snapshots.js b/js/customize-snapshots.js index 4dda53b2..58f7ef43 100644 --- a/js/customize-snapshots.js +++ b/js/customize-snapshots.js @@ -557,7 +557,7 @@ } } ); - request.done( function() { + request.done( function( response ) { var url = api.previewer.previewUrl(), regex = new RegExp( '([?&])customize_snapshot_uuid=.*?(&|$)', 'i' ), notFound = -1, @@ -590,7 +590,8 @@ api.trigger( 'customize-snapshots-update', { previewUrl: url, customizeUrl: customizeUrl, - uuid: component.data.uuid + uuid: component.data.uuid, + response: response } ); } ); diff --git a/php/class-customize-snapshot-manager.php b/php/class-customize-snapshot-manager.php index 9d151242..a73e5970 100644 --- a/php/class-customize-snapshot-manager.php +++ b/php/class-customize-snapshot-manager.php @@ -1125,6 +1125,11 @@ public function handle_update_snapshot_request() { ) ); } + /** + * Add any additional checks before saving snapshot. + */ + do_action( 'customize_snapshot_save_before', $this->snapshot, $this->customize_manager ); + // Set the snapshot UUID. $post_type = get_post_type_object( Post_Type::SLUG ); $authorized = ( $post ? @@ -1181,6 +1186,8 @@ function( $value ) { wp_send_json_error( $data ); } + /** This filter is documented in wp-includes/class-wp-customize-manager.php */ + $data = apply_filters( 'customize_save_response', $data, $this ); wp_send_json_success( $data ); }