diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index c0fdfd9c23..a842287094 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -20,7 +20,7 @@ * @param int $dst_h The destination height. * @param int $src_abs Optional. If the source crop points are absolute. * @param string $dst_file Optional. The destination file to write to. - * @return string|WP_Error|false New filepath on success, WP_Error or false on failure. + * @return string|WP_Error New filepath on success, WP_Error on failure. */ function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) { $src_file = $src; @@ -54,6 +54,9 @@ function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $s $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) ); $result = $editor->save( $dst_file ); + if ( is_wp_error( $result ) ) + return $result; + return $dst_file; }