register_nav_menus() won’t register menus

You don’t need to add any action to register your Nav Menu. Here are some quick steps for you to get your WordPress Nav Menu to work…

Register Nav Menu

if (function_exists('register_nav_menu'))
{
    register_nav_menu('header_menu', 'Header Menu');
}

Define and Use Nav Menu in your Theme:
Usually we place the Menu DIV code in header.php file; so I assume yours is also in header.php file. Open that file and locate the DIV container where you wish your WordPress NAV menu to appear. Here is a sample from one of my recent WordPress themes for your ready reference:

<div class="css-nav" >

<?php wp_nav_menu( array(
    'sort_column' => 'menu_order',
    'theme_location' => 'header_menu',
    'menu_class' => 'css-menu',
    'title_li' => '<div class="l"></div>',
    'link_before' => '<span class="l">',
    'link_after' => '</span>'
) ); ?> </div>

Once you add this code, go to your WP Admin – Menus. Create a new Menu, if you don’t have any yet. As soon as you create a menu, you should see “Theme Location” meta box to the left side of your Menu Item arranger area.

I hope this helps. 🙂

Cheers,

Ruturaj.

Leave a Comment