Bird
0
0

You added this code to your theme's functions.php:

medium📝 Debug Q14 of 15
Wordpress - Themes and Appearance
You added this code to your theme's functions.php:
register_nav_menu('header-menu', 'Header Menu');

But the menu does not appear in the WordPress admin under Appearance > Menus > Manage Locations. What is the likely problem?
AThe code must be inside a function hooked to <code>after_setup_theme</code>
BYou need to flush permalinks to see the menu location
CYou forgot to call <code>register_nav_menus()</code> instead of <code>register_nav_menu()</code>
DMenus only appear if you create a menu first
Step-by-Step Solution
Solution:
  1. Step 1: Understand when to register menus

    Menu registration code should run during theme setup, typically hooked to after_setup_theme.
  2. Step 2: Check if code runs too early

    Placing register_nav_menu() directly in functions.php without hook may run too early, so WordPress doesn't register it properly.
  3. Final Answer:

    The code must be inside a function hooked to after_setup_theme -> Option A
  4. Quick Check:

    Register menus inside after_setup_theme hook [OK]
Quick Trick: Hook menu registration to after_setup_theme [OK]
Common Mistakes:
  • Using register_nav_menus() instead of register_nav_menu() is not required for one menu
  • Flushing permalinks does not affect menu registration
  • Assuming menus appear without registering locations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes