Skip to content

Commit 5f2d089

Browse files
committed
Media: Make adjacent_image_link() include alt text when returning an image.
When using the `adjacent_image_link()` function there is a condition that will return a linked image. Previously, the returned image was sent without alt attributes. Now, `adjacent_image_link()` will include alt attributes of the image's title when an image is returned. Props joedolson, Mista-Flo, sabernhardt. Fixes #52387. git-svn-id: https://develop.svn.wordpress.org/trunk@50274 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 22ffa08 commit 5f2d089

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wp-includes/media.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3441,7 +3441,8 @@ function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false )
34413441

34423442
if ( isset( $attachments[ $k ] ) ) {
34433443
$attachment_id = $attachments[ $k ]->ID;
3444-
$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text );
3444+
$attr = array( 'alt' => get_the_title( $attachment_id ) );
3445+
$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text, $attr );
34453446
}
34463447
}
34473448

0 commit comments

Comments
 (0)