WordPress 3.1.4 is here!
If you’re like me, you dive into the upgrade fairly quick. The admin notification drives me crazy.
I think I need therapy.
For those of you using a theme that has support for multiple custom menus, then you may notice a problem with custom menus after you upgrade.
Here’s the fix:
If your Menu admin panel looks something like this, you’ve got multiple custom menus:
These three custom menus being used appear in multiple places on the front-end:
According to Tom, this is how you fix the Custom Menu 3.1.4 hiccups:
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:
[cc lang=”php”]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’
)
);[/cc]
Add an argument to the array that instructs the system not to use a fallback function. The final code should look like this:
[cc lang=”php”]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
)
);[/cc]
This will prevent WordPress from defaulting to a menu.
Phew!
That was a close one.
Luckily, I was able to make these changes before upgrading!
If you want more information on custom menus, be sure to check out the WordPress codex.
[via More Code]
Matthew Snider says
We good on Standard? I think I am cool, just ,making sure.
Eric Dye says
It depends on how many custom menus you’re spinning.
Jay Caruso says
Just a note. That line is added, but be sure to add the comma after the
'theme_location' => 'top-menu'
So it goes from:
'theme_location' => 'top-menu'
to
'theme_location' => 'top-menu',
And then the added line.
No, I didn’t see that on my own. It was pointed out to me thankfully.
Jay Caruso says
I broke the comments.
#Winning
Eric Dye says
Please stop breaking the blog.
Thank you.
– The Management