Make WordPress Core

Changeset 55106


Ignore:
Timestamp:
01/20/2023 02:15:42 PM (2 years ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r54891 r55106  
    31453145    } else {
    31463146        wp_update_post( $post );
     3147
     3148        /**
     3149         * Fires after an attachment has been updated and before
     3150         * the JSON response is sent.
     3151         *
     3152         * @since 6.2.0
     3153         *
     3154         * @param array $post    The attachment.
     3155         * @param array $changes An array of changes.
     3156         */
     3157        do_action( 'wp_ajax_save_attachment', $post, $changes );
    31473158    }
    31483159
Note: See TracChangeset for help on using the changeset viewer.