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.

Built from https://develop.svn.wordpress.org/trunk@50274


git-svn-id: http://core.svn.wordpress.org/trunk@49919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2021-02-09 17:27:05 +00:00
parent 8bd0709dba
commit 0c5a3fa2ed
2 changed files with 3 additions and 2 deletions

View File

@ -3441,7 +3441,8 @@ function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false )
if ( isset( $attachments[ $k ] ) ) {
$attachment_id = $attachments[ $k ]->ID;
$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text );
$attr = array( 'alt' => get_the_title( $attachment_id ) );
$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text, $attr );
}
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-beta1-50273';
$wp_version = '5.7-beta1-50274';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.