Supressing warnings originating from metadata functions

This commit is contained in:
Joel T 2022-05-11 15:59:49 -07:00
parent 116eaf611b
commit 2ac65955a3
1 changed files with 2 additions and 2 deletions

View File

@ -139,7 +139,7 @@ function wc_rest_set_uploaded_image_as_attachment( $upload, $id = 0 ) {
include_once ABSPATH . 'wp-admin/includes/image.php';
}
$image_meta = wp_read_image_metadata( $upload['file'] );
$image_meta = @wp_read_image_metadata( $upload['file'] );
if ( $image_meta ) {
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
$title = wc_clean( $image_meta['title'] );
@ -159,7 +159,7 @@ function wc_rest_set_uploaded_image_as_attachment( $upload, $id = 0 ) {
$attachment_id = wp_insert_attachment( $attachment, $upload['file'], $id );
if ( ! is_wp_error( $attachment_id ) ) {
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) );
@wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) );
}
return $attachment_id;