It’s more a programming question, but try this:
$post = get_post( get_post_thumbnail_id() );
if ( !isset( $post->post_title ) ) {
echo 'Sorry no title';
} else {
echo $post->post_title;
}
Related Posts:
- Get the size (size in Kb or MB) of an featured image?
- How To Retrieve An Image Attachment’s Alt Text?
- getting attachement images src and add classes
- Check if post has attachments (not image)
- Are captions stored anywhere?
- Validate alt text for attachments?
- Applying automatic link class to images embedded to posts
- get post attachments of a particular size
- Change image link: wp_get_attachment_link
- Multi-line captions on attachments
- Making images from single.php pointing to an attachment .php template
- How to display a shortcode caption somewhere other than the_content
- wp_get_attachment_image_src always returns false
- Exact image sizes
- Get post embedded image caption
- query attachment images … if no attachments -> get attachments of parent page?
- Edit default image attachment size
- Change code to display image attachment page
- Attachment 0×0 size error [closed]
- Add image attachment to post via coding?
- Removing width and height attributes from wp-get-attachment
- Get post attachment images dimension and use in embed code
- use wp_get_attachment_image() to show attachments
- Adding width and height to wp_get_attachment_image_src
- Get the bare URL for an attachment
- Display attachment resolution size
- How to remove attachments size attribute [duplicate]
- How to redirect ‘file url’ to ‘post url’ i.e. in attachment.php
- Check what attached image size is used
- How do I get all attachments that are used in the current post, not just the children?
- Clean up images, delete unused image sizes attached to a post type
- Get title of post image is attached to
- Correct attachment size
- Post Gallery list attachments except the one used as post thumbnail
- Get image attachment to a post outside the loop?
- How to add a caption to an image attachment in a file list?
- How do I intercept and modify the functionality of wp_get_attachment_image()?
- Unable to get wp_get_attachment_url to show
- Get Attachment Image Class by attachment id
- Possible to add “Even/Odd Classes” to image attachments via wp_get_attachment_image?
- Display a post attachment depending on the caption
- changing the default picture size link url
- add image caption
- Get an image from the media library. Struggling with the code?
- How to view exact image dimensions of a media in Admin view?
- Filter not applied to all image sizes
- wp_get_attachment_image_src calling wrong location
- Get attachment URL from attachment Link in WordPress
- Display setting ‘size’ not available in image settings modal
- Hide Image Container if No Image Attachments
- Incomplete attachment page
- How to retrieve “custom url” from image attachment in wordpress
- Retreive tags from attached post for media on page
- Move caption in on attachment page
- list of attachments: wp_get_attachment_link works, wp_get_attachment_image does not
- What is the most efficient way to retrieve a group of image URL’s from different attachment ID’s of a specific crop size?
- get_image_tag filter not working
- Change attachment inside the_content using filters
- How to get image title/alt attribute?
- How does WP media uploader create the 3 different sized images, and how can I duplicate it
- Get Image Description
- How to add a class to the attachment images
- How could I add button next to “edit image” button in “Attachment Details”
- How to paginate attachments in a secondary query as gallery?
- How to add classes to images based on their categories?
- Give attachments an archive page
- How can I hide media library images from general users?
- Insert Media – Attachment – Link to : Remove the “attachment page” option
- Add multiple images to a page sidebar
- Retrieving a custom link on an attachment
- Delete attachments from Front end
- Add custom field to image editor
- Change Attachment Post URLs to File URLs
- How to upload image from front end and save in media library?
- How to create a CSV on the fly and send as an attachment using wp_mail?
- Gutenberg editor get post featured image by id
- Contact Form 7 Data As Attachment [closed]
- Post Via Email – How to send Attachments with it (e.g. PDF File or JPEG Image)?
- Where does the gallery shortcode gets its attachments from?
- Is it possible to share media files between multiple WordPress sites?
- Get post attached image to display in admin dashboard
- Get attachments for posts that belongs to a specific category
- wp_upload_bits Upload Specific Sizes Only
- Set Attachment Image File URL as GUID
- Proper use of wp_get_attachment_image?
- wp get attachment image always gives me thumbnail
- Upload attachment from external site
- Looking to limit file attachment downloads
- Use full size images in a specific gallery
- WP_Query: attachment image in “full” size?
- i want attachment.php to return the image
- wp_delete_attachment doesn’t delete image files / doesn’t work
- Send data URL string as an attachment in wp_email
- How to use previous/next image link, ignoring parent posts/attachments?
- Removing delete permanently button in uploading files media
- How to save media-form on custom tab
- How to access & display images from a post without textual content ( and vice versa) according to best wordpress practices
- I want to edit documents on my blog without the need to download and upload files again [closed]
- No attachments on contact form 7
- wp_mail attachment not working in wordpress