Bird
0
0

Identify the issue in this code snippet that prevents the featured image from displaying:

medium📝 Debug Q6 of 15
Wordpress - Content Management
Identify the issue in this code snippet that prevents the featured image from displaying:
if (has_post_thumbnail) {
  the_post_thumbnail();
}
Athe_post_thumbnail() requires a size parameter
Bhas_post_thumbnail is missing parentheses, so it's not called as a function
CMissing add_theme_support('post-thumbnails') in functions.php
Dthe_post_thumbnail() should be inside the loop
Step-by-Step Solution
Solution:
  1. Step 1: Check function usage

    has_post_thumbnail is a function and must be called with parentheses: has_post_thumbnail()
  2. Step 2: Understand consequences

    Without parentheses, the condition always evaluates to true (because the function name is treated as a string), but no actual check occurs.
  3. Final Answer:

    has_post_thumbnail is missing parentheses -> Option B
  4. Quick Check:

    Functions require parentheses to execute [OK]
Quick Trick: Always call functions with parentheses [OK]
Common Mistakes:
  • Using function names without parentheses in conditions
  • Assuming the_post_thumbnail() needs a size parameter (optional)
  • Forgetting to add theme support (not the cause here)

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes