wp_ajax_crop_image_pre_save

Fires before a cropped image is saved.

Description

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

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

Parameters (3)

0. $context (string)
The Customizer control requesting the cropped image.
1. $attachment_id (int)
The attachment ID of the original image.
2. $cropped (string)
Path to the cropped image file.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped ); 
The following example is for adding a hook callback.
  1. // define the wp_ajax_crop_image_pre_save callback 
  2. function action_wp_ajax_crop_image_pre_save( $context, $attachment_id, $cropped ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'wp_ajax_crop_image_pre_save', 'action_wp_ajax_crop_image_pre_save', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'wp_ajax_crop_image_pre_save', 'action_wp_ajax_crop_image_pre_save', 10, 3 ); 

Defined (1)

The action is defined in the following location(s).

/wp-admin/includes/ajax-actions.php  
  1. do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped );