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

Adam Slaker
Adam Slaker
9,995 Points

wp_nav_menu Manage locations issue

I was working on the wp_nav_menu lesson for the Wordpress Theme development course, and I seem to have run into a minor problem. When adding them_support and then using the register_nav_menus function, I seem to be missing something as my Manage Locations tab won't come up next to the Edit Menus tab in the dashboard of my Wordpress site. I'm sure I am missing some small item such as a semicolon, but I can't for the life of me figure out what is wrong with it. I posted the code below. Let me know if anyone has any suggestions. Thanks guys!

<?php
add_theme_support( 'menus' );

function register_theme_menus() {

  register_nav_menus(
    array(
        'primary-menu' => _( 'Primary Menu' )
    )
  );

}
add_action( 'init', 'register_theme_menus()' );

2 Answers

Andrew Shook
Andrew Shook
31,709 Points

you only need to pass in the name of the function with add_action, you don't need to try and call the function. Simply remove the parentheses and it should work.

<?php
    add_action( 'init', 'register_theme_menus' );
Adam Slaker
Adam Slaker
9,995 Points

Of course! Thanks for your help Andrew. I really appreciate the fast response.