Skip to content

Commit

Permalink
Media Handler checks the title of the image
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaydsouza committed Oct 28, 2023
1 parent 0fa89a9 commit 24df7f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions includes/frontend/class-media-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ public static function get_the_post_thumbnail( $args = array() ) {
$alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
}

// If empty alt then try to get the title of the attachment.
if ( empty( $alt ) && ! empty( $attachment_id ) ) {
$alt = get_the_title( $attachment_id );
}

if ( empty( $alt ) ) {
$alt = $alt_fallback ? $post_title : '';
}
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ Top 10 is one of the many plugins developed by WebberZone. Check out our other p

Release post: [https://webberzone.com/announcements/top-10-v3-3-0/](https://webberzone.com/announcements/top-10-v3-3-0/)

* Enhancements:
* Media Handler checks the title of the image if the alt tag is empty

* Bug fixes:
* Check if `$wp_filters['the_content']` is set. Fixes a PHP warning for users running WordPress before 6.1
* `Import_Export` Class: Fix unnecessary check for `network_admin_menu` filter; Minor code fixes to set headers before outputting data
Expand Down

0 comments on commit 24df7f2

Please sign in to comment.