Changeset 39348 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
- Timestamp:
- 11/23/2016 03:32:25 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r39342 r39348 156 156 $attachment = get_post( $id ); 157 157 158 /** 159 * Fires after a single attachment is created or updated via the REST API. 160 * 161 * @since 4.7.0 162 * 163 * @param WP_Post $attachment Inserted or updated attachment 164 * object. 165 * @param WP_REST_Request $request The request sent to the API. 166 * @param bool $creating True when creating an attachment, false when updating. 167 */ 168 do_action( 'rest_insert_attachment', $attachment, $request, true ); 169 158 170 // Include admin functions to get access to wp_generate_attachment_metadata(). 159 171 require_once ABSPATH . 'wp-admin/includes/admin.php'; … … 177 189 $response->header( 'Location', rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $id ) ) ); 178 190 179 /**180 * Fires after a single attachment is created or updated via the REST API.181 *182 * @since 4.7.0183 *184 * @param object $attachment Inserted attachment.185 * @param WP_REST_Request $request The request sent to the API.186 * @param bool $creating True when creating an attachment, false when updating.187 */188 do_action( 'rest_insert_attachment', $attachment, $request, true );189 190 191 return $response; 191 192 } … … 220 221 $attachment = get_post( $request['id'] ); 221 222 223 /* This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php */ 224 do_action( 'rest_insert_attachment', $data, $request, false ); 225 222 226 $fields_update = $this->update_additional_fields_for_object( $attachment, $request ); 223 227 … … 229 233 $response = $this->prepare_item_for_response( $attachment, $request ); 230 234 $response = rest_ensure_response( $response ); 231 232 /* This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php */233 do_action( 'rest_insert_attachment', $data, $request, false );234 235 235 236 return $response;
Note: See TracChangeset
for help on using the changeset viewer.