WP 4.0 upgrade displays wrong menu
-
I just upgraded to WP 4.0, and it broke my main navigation menu. First, it showed only the “top” level of the menu, none of the dropdowns. Reading another thread, I changed from
<?php wp_nav_menu( ); ?>
in my header.php file to:
<?php wp_nav_menu( array( 'theme_location' => 'topMenu') ); ?>
I also tried
<?php wp_nav_menu( array( 'menu' => 'topMenu') ); ?>
but in both cases, WP now diplays a default menu instead of my topMenu! I can tell because it’s alphabetical showing of all the pages, instead of the drop-down structure of my specified topMenu!!
Here is url of my site:
http://WriteYourBestsellerBook.com
I’ve looked at the specs on wp_nav_menu, and don’t understand the parameters. Apparently, I am missing something. Please assist, thanks!
-
Fixed it!
I went to the codex page on navigation menus:
http://codex.wordpress.org/Navigation_Menus
and used the following code in my theme’s functions.php file:function register_my_menus() { register_nav_menus( array( 'main-menu' => __( 'Main Nav Menu' ), 'extra-menu' => __( 'Extra Menu' ) ) ); } add_action( 'init', 'register_my_menus' );(Turns out this function was already in my functions.php file; I customized it for my purposes.)
Then I put this code into my header.php file:
<?php wp_nav_menu( array( 'theme_location' => 'main-menu' ) ); ?>And then logged into my WordPress site, went to
Appearance > Menus > Manage Locations
and specified which of my custom menus to use as myMain Nav Menu.Then went back to my site and voila! All was again well.
Anyway, I see lots of folks are having menu issues with WP 4.0, so I’m putting here the solution that fixed my problem for me.
YAY!
The topic ‘WP 4.0 upgrade displays wrong menu’ is closed to new replies.