WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/16/2018 02:16:16 AM (22 months ago)
Author:
jeremyfelt
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r44127 r44225  
    747747
    748748        $request->set_param( 'context', 'edit' );
     749
     750        // Filter is fired in WP_REST_Attachments_Controller subclass.
     751        if ( 'attachment' === $this->post_type ) {
     752            $response = $this->prepare_item_for_response( $post, $request );
     753            return rest_ensure_response( $response );
     754        }
    749755
    750756        /** 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.