diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index 6b7963d2fb0413..0ef998b89fa969 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -13,9 +13,9 @@ * @return string Returns the block content with the data-id attribute added. */ function render_block_core_image( $attributes, $content ) { - if ( $attributes['id'] ) { + if ( isset( $attributes['id'] ) ) { // Add the data-id="$id" attribute to the img element to retain backwards compatibility. - $data_id_attribute = 'data-id="' . esc_attr( $attributes['id'] ) . '"'; + $data_id_attribute = 'data-id="' . esc_attr( $attributes['id'] ) . '"'; if ( ! strpos( $content, $data_id_attribute ) ) { $content = str_replace( '