Ok, this is a biggie. Here’s the deal:
I have upwards of 50 installs of WordPress running on MAMP Pro locally. For some of them I use local/whatever, for others I set up virtual hosts as whatever.local/. WordPress has never had any problems. Yesterday, installed a copy of WP 3.0.1 (fresh, straight off the server), and started templating. Today, I returned to it to continue, first by registing default navigations. I put the necessary lines in functions.php:
add_theme_support( 'menus' );
add_action('init', 'register_custom_menu');
function register_custom_menus() {
register_nav_menu('primary_menu', __('Header Menu'));
register_nav_menu('404_menu', __('404 Menu'));
}
Fine, right? I also tried it with register_custom_menu, one at a time. In WordPress, no default menus show up. I’ve tried:
- Activate a different theme, re-activate the original
- Try Twenty Ten – still no custom navigations although a ‘primary menu’ is registered in the code, so it is NOT my functions.php
- Tried another theme that I have running locally (that works perfectly in its original place), still no navs
- Delete the entire database and re-install WP
- Delete the entire directory, re-download WP, reinstall
- Delete the virtual host and work from localhost/whatever
So, I have a ton of other WP sites working perfectly fine with nav registering, but I can’t create any more? I’m completely, totally lost.
Any input would be appreciated, right now I’m at my wit’s end. Let me know if you need any more information.
Three things:
'after_setup_theme'
, not'init'
add_theme_support()
sinceregister_nav_menu()
takes care of that.register_nav_menus()
to take care of all your menus at once.However, the biggest reason this isn’t working is because you’re not calling your function. The callback on
add_action
should be'register_custom_menus'
(notice plural). The spelling has to match the function declaration. This is how I’d suggest you rewrite it: