wp_save_image_editor_file

Filters whether to skip saving the image file.

Description

apply_filters( 'wp_save_image_editor_file', (null) $null, (string) $filename, (WP_Image_Editor) $image, (string) $mime_type, (int) $post_id ); 

Returning a non-null value will short-circuit the save method, returning that value instead.

Parameters (5)

0. $null (null) => null
Value to return instead of saving. Default null.
1. $filename (string)
Name of the file to be saved.
2. $image (WP_Image_Editor)
WP_Image_Editor instance.
3. $mime_type (string)
Image mime type.
4. $post_id (int)
The post id.

Usage

To run the hook, copy the example below.
  1. $null = apply_filters( 'wp_save_image_editor_file', $null, $filename, $image, $mime_type, $post_id ); 
  2.  
  3. if ( !empty( $null ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_save_image_editor_file callback 
  2. function filter_wp_save_image_editor_file( $null, $filename, $image, $mime_type, $post_id ) { 
  3. // make filter magic happen here... 
  4. return $null
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_save_image_editor_file', 'filter_wp_save_image_editor_file', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_save_image_editor_file', 'filter_wp_save_image_editor_file', 10, 5 ); 

Defined (1)

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

/wp-admin/includes/image-edit.php  
  1. $saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );