Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development Building Out WordPress Navigation The wp_nav_menu Function

Clare A
Clare A
23,994 Points

Fatal error: Cannot redeclare register_nav_menus()

After calling the register_theme_menus() function, I get the following error;

Fatal error: Cannot redeclare register_nav_menus() (previously declared in /Users/xxx/Sites/localwp.dev/wp-includes/nav-menu.php:88)

Commenting out register_nav_menus() function in nav-menu.php resolves it for me, but what is the impact of doing this? It looks like nav-menu.php is registering menu locations for themes and I'm probably breaking it for other themes by doing this.

1 Answer

Clare A
Clare A
23,994 Points

Sorry guys, found the issue - silly one on my part (forehead slap).

I had 'function' written before register_nav_menus().