Merge pull request #29783 from macr1408/trunk

Check for WP Error when uploading products placeholder
This commit is contained in:
Claudio Sanches 2021-05-26 19:28:43 -03:00 committed by GitHub
commit e745be1b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -1332,7 +1332,12 @@ CREATE TABLE {$wpdb->prefix}wc_reserved_stock (
'post_content' => '',
'post_status' => 'inherit',
);
$attach_id = wp_insert_attachment( $attachment, $filename );
$attach_id = wp_insert_attachment( $attachment, $filename );
if ( is_wp_error( $attach_id ) ) {
update_option( 'woocommerce_placeholder_image', 0 );
return;
}
update_option( 'woocommerce_placeholder_image', $attach_id );