Skip to content

Commit 682fb8f

Browse files
committed
refactor: use get_post_field() instead of get_the_title() for attachment alt text in Media_Handler
1 parent 74a885c commit 682fb8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

includes/frontend/class-media-handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public static function get_the_post_thumbnail( $args = array() ) {
263263

264264
// If empty alt then try to get the title of the attachment.
265265
if ( empty( $alt ) && ! empty( $attachment_id ) ) {
266-
$alt = get_the_title( $attachment_id );
266+
$alt = get_post_field( 'post_title', $attachment_id );
267267
}
268268

269269
if ( empty( $alt ) ) {

0 commit comments

Comments
 (0)