Screening Entry Level

Describe the WordPress template hierarchy. How does WordPress determine which template file to use for a given request?

Quick Tip

Walk through a concrete example: "For a custom post type 'event' with slug 'annual-gala', WordPress looks for single-event-annual-gala.php, then single-event.php, then single.php, then singular.php, then index.php."

What good answers include

WordPress follows a hierarchy from most specific to least specific. For a single post: single-{post_type}-{slug}.php → single-{post_type}.php → single.php → singular.php → index.php. For archives: archive-{post_type}.php → archive.php → index.php. For taxonomies: taxonomy-{taxonomy}-{term}.php → taxonomy-{taxonomy}.php → taxonomy.php → archive.php → index.php. Template parts (get_template_part) allow reuse. Child themes override parent templates by filename. Strong candidates mention: template_include filter for programmatic overrides, is_singular()/is_archive() for conditional logic, and how block themes change the hierarchy with HTML template files.

What interviewers are looking for

Fundamental WordPress knowledge. Candidates who cannot explain the template hierarchy will struggle to debug why the wrong template is rendering. Ask them to trace the hierarchy for a specific content type they have worked with.

← All WordPress questions