wp_save_image_editor_file
Filters whether to skip saving the image file.
Returning a non-null value will short-circuit the save method, returning that value instead.
Usage
add_filter( 'wp_save_image_editor_file', 'wp_kama_save_image_editor_file_filter', 10, 5 ); /** * Function for `wp_save_image_editor_file` filter-hook. * * @param bool|null $override Value to return instead of saving. * @param string $filename Name of the file to be saved. * @param WP_Image_Editor $image The image editor instance. * @param string $mime_type The mime type of the image. * @param int $post_id Attachment post ID. * * @return bool|null */ function wp_kama_save_image_editor_file_filter( $override, $filename, $image, $mime_type, $post_id ){ // filter... return $override; }
- $override(true|false|null)
- Value to return instead of saving.
Default: null - $filename(string)
- Name of the file to be saved.
- $image(WP_Image_Editor)
- The image editor instance.
- $mime_type(string)
- The mime type of the image.
- $post_id(int)
- Attachment post ID.
Changelog
Since 3.5.0 | Introduced. |
Where the hook is called
wp-admin/includes/image-edit.php 450
$saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );