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
208
209           /**
210            * Filter the WP_Image_Editor instance for the image to be streamed to the browser.
211            *
212            * @since 3.5.0
213            *
214            * @param WP_Image_Editor $image   WP_Image_Editor instance.
215            * @param int             $post_id Post ID.
216            */
217           $image = apply_filters( 'image_editor_save_pre', $image, $post_id );
218
219           if ( is_wp_error( $image->stream( $mime_type ) ) )
220                return false;
221
222           return true;
223      } else {
224           _deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
225
226           /**
 
Line Code
257  * @param WP_Image_Editor $image
258  * @param string $mime_type
259  * @param int $post_id
260  * @return boolean
261  */
262 function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
263      if ( $image instanceof WP_Image_Editor ) {
264
265           /** This filter is documented in wp-admin/includes/image-edit.php */
266           $image = apply_filters( 'image_editor_save_pre', $image, $post_id );
267
268           /**
269            * Filter whether to skip saving the image file.
270            *
271            * Returning a non-null value will short-circuit the save method,
272            * returning that value instead.
273            *
274            * @since 3.5.0
275            *