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.
- // run the action
- do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped );
- The following example is for adding a hook callback.
- // define the wp_ajax_crop_image_pre_save callback
- function action_wp_ajax_crop_image_pre_save( $context, $attachment_id, $cropped ) {
- // make action magic happen here...
- };
- // add the action
- 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.
- // remove the action
- 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
- do_action( 'wp_ajax_crop_image_pre_save', $context, $attachment_id, $cropped );