Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: image_editor_save_pre

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
243
244           /**
245            * Filters the WP_Image_Editor instance for the image to be streamed to the browser.
246            *
247            * @since 3.5.0
248            *
249            * @param WP_Image_Editor $image   WP_Image_Editor instance.
250            * @param int             $post_id Post ID.
251            */
252           $image = apply_filters( 'image_editor_save_pre', $image, $post_id );
253
254           if ( is_wp_error( $image->stream( $mime_type ) ) )
255                return false;
256
257           return true;
258      } else {
259           _deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
260
261           /**
 
Line Code
292  * @param WP_Image_Editor $image
293  * @param string $mime_type
294  * @param int $post_id
295  * @return bool
296  */
297 function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
298      if ( $image instanceof WP_Image_Editor ) {
299
300           /** This filter is documented in wp-admin/includes/image-edit.php */
301           $image = apply_filters( 'image_editor_save_pre', $image, $post_id );
302
303           /**
304            * Filters whether to skip saving the image file.
305            *
306            * Returning a non-null value will short-circuit the save method,
307            * returning that value instead.
308            *
309            * @since 3.5.0
310            *