Bird
0
0

If a category archive page is requested and the theme has category-slug.php, category-id.php, and category.php files, which template will WordPress use?

medium📝 component behavior Q5 of 15
Wordpress - Theme Structure and Basics
If a category archive page is requested and the theme has category-slug.php, category-id.php, and category.php files, which template will WordPress use?
Aarchive.php
Bcategory.php
Ccategory-id.php
Dcategory-slug.php
Step-by-Step Solution
Solution:
  1. Step 1: Understand category template priority

    WordPress first looks for category-{slug}.php, then category-{id}.php, then category.php.
  2. Step 2: Identify highest priority template

    Since category-slug.php exists, it will be used.
  3. Final Answer:

    category-slug.php -> Option D
  4. Quick Check:

    Category archive uses category-slug.php first [OK]
Quick Trick: Category slug template has highest priority [OK]
Common Mistakes:
  • Choosing category-id.php over category-slug.php
  • Using category.php instead of slug variant
  • Assuming archive.php is used

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes