rest_after_insert_attachment

rest_after_insert_attachment

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.4.3

do_action('rest_after_insert_attachment') is found 2 times:

  • /wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php line 200
    		 * @param WP_Post         $attachment Inserted or updated attachment object.
    		 * @param WP_REST_Request $request    Request object.
    		 * @param bool            $creating   True when creating an attachment, false when updating.
    		 */
    		do_action( 'rest_after_insert_attachment', $attachment, $request, true );
    
    		wp_after_insert_post( $attachment, false, null );
    
    		if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
    			/*
    			 * Set a custom header with the attachment_id.
    
  • /wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php line 361
     
    		$request->set_param( 'context', 'edit' );
    
    		/** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php */
    		do_action( 'rest_after_insert_attachment', $attachment, $request, false );
    
    		wp_after_insert_post( $attachment, true, $attachment_before );
    
    		$response = $this->prepare_item_for_response( $attachment, $request );
    		$response = rest_ensure_response( $response );
    
    

See this hook used in plugins: