Bird
0
0

Which of the following is the correct way to display a registered menu in a WordPress theme?

easy📝 Syntax Q12 of 15
Wordpress - Themes and Appearance
Which of the following is the correct way to display a registered menu in a WordPress theme?
A<code>register_nav_menu('primary', 'Primary Menu');</code>
B<code>wp_nav_menu(array('theme_location' => 'primary'));</code>
C<code>add_menu_location('primary');</code>
D<code>show_menu('primary');</code>
Step-by-Step Solution
Solution:
  1. Step 1: Identify function to display menu

    wp_nav_menu() is used to show menus in themes.
  2. Step 2: Check correct syntax for displaying menu

    Passing array('theme_location' => 'primary') tells WordPress which menu to show.
  3. Final Answer:

    wp_nav_menu(array('theme_location' => 'primary')); -> Option B
  4. Quick Check:

    Display menu = wp_nav_menu() with theme_location [OK]
Quick Trick: Use wp_nav_menu() with theme_location to show menus [OK]
Common Mistakes:
  • Using register_nav_menu() to display menus instead of register
  • Trying to use non-existent functions like add_menu_location or show_menu

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes