Bird
0
0

A developer created a template file named single-posttype.php but WordPress still uses single.php for that custom post type. What is the likely error?

medium📝 Debug Q6 of 15
Wordpress - Theme Structure and Basics
A developer created a template file named single-posttype.php but WordPress still uses single.php for that custom post type. What is the likely error?
AThe file name should be single-posttype.php with the exact post type slug
Bsingle.php always overrides custom post type templates
CThe template file must be named posttype-single.php
DCustom post types cannot have custom single templates
Step-by-Step Solution
Solution:
  1. Step 1: Check template file naming rules

    Custom post type single templates must be named single-{post_type}.php exactly matching the post type slug.
  2. Step 2: Identify naming mismatch

    If the file name does not match the post type slug, WordPress falls back to single.php.
  3. Final Answer:

    The file name should be single-posttype.php with the exact post type slug -> Option A
  4. Quick Check:

    Template file name must match post type slug [OK]
Quick Trick: Template file name must exactly match post type slug [OK]
Common Mistakes:
  • Assuming single.php overrides custom templates
  • Using wrong file name order
  • Thinking custom post types can't have templates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes