Bird
0
0

Identify the error in this code snippet that tries to display a featured image:

medium📝 Debug Q14 of 15
Wordpress - Content Management
Identify the error in this code snippet that tries to display a featured image:
if (has_post_thumbnail) {
  the_post_thumbnail();
}
AMissing semicolon after the_post_thumbnail()
BMissing parentheses after has_post_thumbnail
CNo error, code is correct
Dthe_post_thumbnail() should have an argument
Step-by-Step Solution
Solution:
  1. Step 1: Check function usage

    has_post_thumbnail is a function and must be called with parentheses ().
  2. Step 2: Verify other parts

    the_post_thumbnail() can be called without arguments; the semicolon is present after it.
  3. Final Answer:

    Missing parentheses after has_post_thumbnail -> Option B
  4. Quick Check:

    Function calls need () [OK]
Quick Trick: Always add () when calling functions [OK]
Common Mistakes:
MISTAKES
  • Forgetting parentheses on function calls
  • Thinking arguments are always required
  • Assuming semicolons are mandatory in PHP

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes