Bird
0
0

How can you retrieve the URL of a post's featured image to use it in a custom HTML tag?

hard📝 Application Q9 of 15
Wordpress - Content Management
How can you retrieve the URL of a post's featured image to use it in a custom HTML tag?
A$url = get_the_post_thumbnail_url($post->ID, 'full');
B$url = the_post_thumbnail_url('full');
C$url = get_post_thumbnail($post->ID);
D$url = get_featured_image_url('full');
Step-by-Step Solution
Solution:
  1. Step 1: Identify function to get featured image URL

    get_the_post_thumbnail_url() returns the URL of the featured image.
  2. Step 2: Use correct parameters

    Pass post ID and size ('full') to get the full image URL.
  3. Final Answer:

    $url = get_the_post_thumbnail_url($post->ID, 'full'); -> Option A
  4. Quick Check:

    Get featured image URL = get_the_post_thumbnail_url() [OK]
Quick Trick: Use get_the_post_thumbnail_url() to get image URL [OK]
Common Mistakes:
  • Using the_post_thumbnail_url() which does not exist
  • Using get_post_thumbnail() which is invalid
  • Using non-existent get_featured_image_url()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes