WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/03/2018 02:13:16 PM (2 years ago)
Author:
danielbachhuber
Message:

REST API: Prevent duplicate firing of rest(_after)?_insert_attachment actions.

Props danielbachhuber, peterwilsoncc.
Fixes #45269.
See #42864.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r43770 r43862  
    739739
    740740        $request->set_param( 'context', 'edit' );
     741
     742        // Filter is fired in WP_REST_Attachments_Controller subclass.
     743        if ( 'attachment' === $this->post_type ) {
     744            $response = $this->prepare_item_for_response( $post, $request );
     745            return rest_ensure_response( $response );
     746        }
    741747
    742748        /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
Note: See TracChangeset for help on using the changeset viewer.