📝 Fix a Child Theme’s Template Override Silently Ignored Because the File Was Placed One Directory Level Too Deep
WordPress’s template hierarchy and functions like get_template_part() resolve a child theme’s override by checking the exact same relative path inside the child theme’s folder that the parent theme used to load the file – not wherever that file happens to live inside the parent theme’s own source repository. A developer who mirrors the parent theme’s full project layout, source folder and all, when creating the override ends up placing it one directory level deeper than WordPress will ever look, and because there’s no error for an override that simply isn’t found, the site keeps rendering the parent’s original template with nothing in the admin area suggesting the override was ever misplaced.
🔎 The Problem
Parent theme calls (inc/template-functions.php):
get_template_part( 'template-parts/content', 'product' );
-> WordPress looks for: template-parts/content-product.php
directly under the ACTIVE theme's root folder
Child theme file actually created at:
child-theme/templates/template-parts/content-product.php
(mirrors the parent theme's own /templates source folder,
which only exists in the parent's build process, not at runtime)
Result: get_template_part() checks child-theme/template-parts/content-product.php,
finds nothing there, silently falls back to the parent theme's version -
the child override file sits one folder deeper and is never found
✅ Fix: Match the Parent’s Exact Relative Path, Not Its Source Layout
- Open the parent theme’s actual get_template_part(), locate_template(), or include call and copy the literal relative path argument it passes – that path, measured from the theme’s root, is the only path WordPress ever checks in the child theme.
- If the parent theme ships its own build or source repository with a different internal folder structure, remember that structure is not what ends up loaded at runtime – always verify against the compiled/active theme folder on the actual site, not the parent theme’s source project.
- After adding an override, confirm it’s actually being picked up by making an obvious, temporary visual change to it and reloading the page – a change that doesn’t appear confirms the file is sitting in the wrong location before you spend time debugging anything else.
🚨 Why This Is Dangerous
- A misplaced override can sit in the child theme for months looking like the customization was made, while every visitor keeps seeing the parent theme’s unmodified markup, and the mistake usually only surfaces when someone finally notices the “customized” page never actually changed.
A child theme override only exists to WordPress at the exact relative path the parent’s own code asked for, and a file one folder too deep is, as far as the template hierarchy is concerned, a file that was never created.
