Screening Entry Level

How do you create and display navigation menus in WordPress? Explain menu registration, the Appearance menu editor, and wp_nav_menu().

Quick Tip

Show the flow: "Register locations with register_nav_menus, the admin creates menus and assigns them to locations, and the theme outputs them with wp_nav_menu. I use a custom Walker class when I need specific HTML structure for the navigation."

What good answers include

Register menu locations with register_nav_menus() in functions.php, hooked to after_setup_theme. This tells WordPress the theme supports menus at named locations (primary, footer, etc.). Administrators create menus in Appearance → Menus, adding pages, posts, categories, custom links, and arranging them with drag-and-drop. Display in templates with wp_nav_menu() passing the theme_location argument. Key parameters: container (wrapper HTML), menu_class (CSS class on the ul), depth (nesting level), fallback_cb (what to show if no menu is assigned), and walker (custom Walker_Nav_Menu for advanced HTML output). Strong candidates mention: that block themes use the Navigation block instead of wp_nav_menu(), menu items can have CSS classes for styling active states, and the wp_nav_menu_items filter for programmatically adding items.

What interviewers are looking for

Entry-level theme development question. Candidates who hardcode navigation links will produce themes that clients cannot edit. Those who understand the menu registration and display flow build themes that are genuinely user-friendly.

← All WordPress questions