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 trialMaximiliane Quel
Courses Plus Student 55,489 PointsTo add or not add theme support
Looking at the WordPress Codex for the register_nav_menus function it reads in the notes:
This function automatically registers custom menu support for the theme therefore you do not need to call add_theme_support( 'menus' );
So should we just cut this bit of code out of our functions.php or is there are reason why we are doing it nevertheless? Am I looking at the wrong part of the codex? Is our example different in some way? Should I read no need to as but you can if you want to?
2 Answers
J Andrew Scott
30,626 PointsThe behavior of register_nav_menus()
was modified in WP 3.0. Explicitly calling add_theme_support( 'menus' );
would probably be for legacy support on older releases (2.9, 2.9.1, 2.9.2). Realistically, though, with the current release up to 3.9, this should be a non-issue.
That said, calling add_theme_support( 'menus' );
multiple times makes no difference to the theme, so keeping it won't hurt anything.
Maximiliane Quel
Courses Plus Student 55,489 PointsThanks, that's very useful.