Get the first array item for the alt_text. (#35009)

This commit is contained in:
Barry Hughes 2023-01-16 16:28:32 -08:00 committed by GitHub
commit f4af1b7a84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Improve the way we retrieve the alt text property for product attachments.

View File

@ -788,7 +788,7 @@ function wc_get_product_attachment_props( $attachment_id = null, $product = fals
}
$alt_text = array_filter( $alt_text );
$props['alt'] = isset( $alt_text[0] ) ? $alt_text[0] : '';
$props['alt'] = $alt_text ? reset( $alt_text ) : '';
// Large version.
$full_size = apply_filters( 'woocommerce_gallery_full_size', apply_filters( 'woocommerce_product_thumbnails_large_size', 'full' ) );