WordPress 3.1.4 and Custom Menu Regression

WordPress just released version 3.1.4. Overall, it’s a solid release but if you’re working with a theme that has support for multiple custom menus, then you may notice a regression with custom menus after you upgrade the application.

Specifically, all custom menu locations that do not contain a menu actually display all pages on the site.  For example, if your Menu admin panel looks like this (notice three custom menus, two of which are empty:

Then your navigation area likely looks something like this (notice two menus displaying all content):

In order to fix this, you need to provide one extra argument in each place the custom menu is called. Locate the calls to wp_nav_menu in your code. You should find something that looks like this:

wp_nav_menu(
  array(
    'sort_column' => 'menu-order',
    'menu_class' => 'nav clearfix fl',
    'container_id' => 'menu_top',
    'container_class' => 'menu clearfix fl',
    'show_home' => 0,
    'theme_location' => 'top-menu'
  )
);

Add an argument to the array that instructs the system not to use a fallback function. The final code should look like this:

wp_nav_menu(
  array(
    'sort_column' => 'menu-order',
    'menu_class' => 'nav clearfix fl',
    'container_id' => 'menu_top',
    'container_class' => 'menu clearfix fl',
    'show_home' => 0,
    'theme_location' => 'top-menu',
    'fallback_cb' => false
  )
);

This will prevent WordPress from defaulting to a menu. For more information on custom menus, check out the codex.

6 Replies to “WordPress 3.1.4 and Custom Menu Regression”

      1. Cool. That all worked. Initially, I forgot the commas, got a parsing error, and was not able to log in to the dashboard. Oops. So uploaded the standardtheme.php via FTP, and made sure I added the commas. Very important! Ha ha!

        Now all works well. Thanks!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.