--- ./wp-admin/includes/image.php--BACKUP--2016-02-25--01 2016-02-25 20:04:29.204726000 -0800 +++ ./wp-admin/includes/image.php 2016-02-25 20:30:36.872726000 -0800 @@ -71,7 +71,7 @@ * * @param int $attachment_id Attachment Id to process. * @param string $file Filepath of the Attached image. - * @return mixed Metadata for attachment. + * @return mixed Metadata for attachment or WP_Error on failure. */ function wp_generate_attachment_metadata( $attachment_id, $file ) { $attachment = get_post( $attachment_id ); @@ -119,9 +119,9 @@ if ( $sizes ) { $editor = wp_get_image_editor( $file ); + if ( is_wp_error( $editor ) ) return $editor; - if ( ! is_wp_error( $editor ) ) - $metadata['sizes'] = $editor->multi_resize( $sizes ); + $metadata['sizes'] = $editor->multi_resize( $sizes ); } else { $metadata['sizes'] = array(); }