diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index ab9d302070..a03ccf9760 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -741,6 +741,20 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { return true; } } else { + $dir_name = dirname( $filename ); + $dir_exists = wp_mkdir_p( $dir_name ); + + if ( ! $dir_exists ) { + return new WP_Error( + 'image_save_error', + sprintf( + /* translators: %s: Directory path. */ + __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), + esc_html( $dir_name ) + ) + ); + } + try { return $image->writeImage( $filename ); } catch ( Exception $e ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 03b76ce81b..f3752a8f84 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-beta3-49541'; +$wp_version = '5.6-beta3-49542'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.