I use this code to display featured image title, caption (excerpt), description (content):

echo get_post(get_post_thumbnail_id())->post_title;
echo get_post(get_post_thumbnail_id())->post_excerpt;
echo get_post(get_post_thumbnail_id())->post_content;

But, how to check if there is any of those fields first?

For example, how to check if there is caption, and if emty to show some other text?

Best regards.

Read more here: How to check if there is image title, caption, description?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: