diff --git a/src/wp-content/themes/twentytwentyone/inc/template-functions.php b/src/wp-content/themes/twentytwentyone/inc/template-functions.php
index 2bee7d6f95..6498c7dfa9 100644
--- a/src/wp-content/themes/twentytwentyone/inc/template-functions.php
+++ b/src/wp-content/themes/twentytwentyone/inc/template-functions.php
@@ -457,7 +457,7 @@ function twenty_twenty_one_get_attachment_image_attributes( $attr, $attachment,
 		$height = (int) $size[1];
 	} elseif ( $attachment && is_object( $attachment ) && $attachment->ID ) {
 		$meta = wp_get_attachment_metadata( $attachment->ID );
-		if ( $meta['width'] && $meta['height'] ) {
+		if ( isset( $meta['width'] ) && isset( $meta['height'] ) ) {
 			$width  = (int) $meta['width'];
 			$height = (int) $meta['height'];
 		}
