mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Media: Add an action hook on wp_ajax_save_attachment().
This changeset introduces the `wp_ajax_save_attachment` action hook, triggered after an attachment has been updated and before the JSON response is sent. For example, it allows developers to update any additional attachment fields that have been rendered by extending the `media.view.Attachment.Details` subview. Props griffinjt, bradyvercher, pputzer, antpb, sc0ttkclark, audrasjb, costdev, hellofromTonya. Fixes #23148. git-svn-id: https://develop.svn.wordpress.org/trunk@55106 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3144,6 +3144,17 @@ function wp_ajax_save_attachment() {
|
||||
wp_delete_post( $id );
|
||||
} else {
|
||||
wp_update_post( $post );
|
||||
|
||||
/**
|
||||
* Fires after an attachment has been updated and before
|
||||
* the JSON response is sent.
|
||||
*
|
||||
* @since 6.2.0
|
||||
*
|
||||
* @param array $post The attachment.
|
||||
* @param array $changes An array of changes.
|
||||
*/
|
||||
do_action( 'wp_ajax_save_attachment', $post, $changes );
|
||||
}
|
||||
|
||||
wp_send_json_success();
|
||||
|
||||
Reference in New Issue
Block a user