Bird
0
0

If a child theme contains a header.php file, what happens when WordPress loads the header?

medium📝 component behavior Q5 of 15
Wordpress - Theme Structure and Basics
If a child theme contains a header.php file, what happens when WordPress loads the header?
AWordPress loads both headers and merges them
BWordPress ignores the child header and loads the parent header
CWordPress loads the child theme's <code>header.php</code> instead of the parent's
DWordPress throws an error due to duplicate files
Step-by-Step Solution
Solution:
  1. Step 1: Understand template hierarchy override

    WordPress uses child theme files first if they exist.
  2. Step 2: Effect of child header.php

    Child theme's header.php replaces the parent's when loading header.
  3. Final Answer:

    WordPress loads the child theme's header.php instead of the parent's -> Option C
  4. Quick Check:

    Child template overrides parent template [OK]
Quick Trick: Child theme files override parent files by name [OK]
Common Mistakes:
MISTAKES
  • Thinking both files load or merge
  • Expecting parent file to load despite child override
  • Assuming error occurs due to duplicate filenames

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes