wppaste
WordPress

do_action( 'wp_ajax_crop_image_pre_save', string $context, int $attachment_id, string $cropped )

Since
4.3.0
Fires before a cropped image is saved.

Description

Allows to add filters to modify the way a cropped image is saved.

Compatibility

WordPress
since 4.3.0
  • 6.7.10
  • 6.8.11
  • 6.9.10
  • 7.0.7
  • 7.1.3

Present in every tracked release (6.7.10 to 7.1.3).

Parameters

$contextstring
The Customizer control requesting the cropped image.
$attachment_idint
The attachment ID of the original image.
$croppedstring
Path to the cropped image file.

Where this hook fires · 1

  • wp-admin/includes/ajax-actions.php:4120wp_ajax_crop_image()

Source code

			 * @since 4.3.0			 *			 * @param string $context       The Customizer control requesting the cropped image.			 * @param int    $attachment_id The attachment ID of the original image.			 * @param string $cropped       Path to the cropped image file.			 */			do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped ); 			/** This filter is documented in wp-admin/includes/class-custom-image-header.php */			$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. 			// Copy attachment properties.			$attachment = wp_copy_parent_attachment_properties( $cropped, $attachment_id, $context );

Changelog

Introduced in 4.3.0. Unchanged from 6.7.10 through 7.1.3.

  1. 6.7.10
  2. 6.8.11
  3. 6.9.10
  4. 7.0.7
  5. 7.1.3

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.3 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.