Action hook 'wp_ajax_crop_image_pre_save'

in WP Core File wp-admin/includes/ajax-actions.php at line 4069

View Source

wp_ajax_crop_image_pre_save

Action Hook
Description
Fires before a cropped image is saved. Allows to add filters to modify the way a cropped image is saved.

Hook Information

File Location wp-admin/includes/ajax-actions.php View on GitHub
Hook Type Action
Line Number 4069

Hook Parameters

Type Name Description
string $context The Customizer control requesting the cropped image.
int $attachment_id The attachment ID of the original image.
string $cropped Path to the cropped image file.

Usage Examples

Basic Usage
<?php
// Hook into wp_ajax_crop_image_pre_save
add_action('wp_ajax_crop_image_pre_save', 'my_custom_function', 10, 3);

function my_custom_function($context, $attachment_id, $cropped) {
    // Your custom code here
}

Source Code Context

wp-admin/includes/ajax-actions.php:4069 - How this hook is used in WordPress core
<?php
4064  			 *
4065  			 * @param string $context       The Customizer control requesting the cropped image.
4066  			 * @param int    $attachment_id The attachment ID of the original image.
4067  			 * @param string $cropped       Path to the cropped image file.
4068  			 */
4069  			do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped );
4070  
4071  			/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
4072  			$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
4073  
4074  			// Copy attachment properties.

PHP Documentation

<?php
/**
			 * Fires before a cropped image is saved.
			 *
			 * Allows to add filters to modify the way a cropped image is saved.
			 *
			 * @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.
			 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-admin/includes/ajax-actions.php
Related Hooks

Related hooks will be displayed here in future updates.