mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 15:16:59 +00:00
REST API: Prevent duplicate firing of rest(_after)?_insert_attachment actions.
Merges [43862] from the 5.0 branch to trunk. Props danielbachhuber, peterwilsoncc. Fixes #45269. See #42864. git-svn-id: https://develop.svn.wordpress.org/trunk@44225 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -747,6 +747,12 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
|
||||
$request->set_param( 'context', 'edit' );
|
||||
|
||||
// Filter is fired in WP_REST_Attachments_Controller subclass.
|
||||
if ( 'attachment' === $this->post_type ) {
|
||||
$response = $this->prepare_item_for_response( $post, $request );
|
||||
return rest_ensure_response( $response );
|
||||
}
|
||||
|
||||
/** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
|
||||
do_action( "rest_after_insert_{$this->post_type}", $post, $request, false );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user