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

PHP

`register_nav_menus` function already adds theme support for menus!

Seems like register_nav_menus function already adds theme support for menus!, so we don't need to use add_theme_support( 'menus' ).

Also, I've reviewed the official WordPress theme functions.php and they seem to not use add_action to call the register_nav_menus function. They simply use the function to register the locations directly:

// Register & add support for theme menus
register_nav_menus( array(
  'main_menu' => __('Main Menu', 'portfolio')
) );

Is that OK?

1 Answer

This function automatically registers custom menu support for the theme therefore you do not need to call add_theme_support( 'menus' );

So, ofcourse this is Ok :)