wp_nav_menu breaks on initial page load; fixed on refresh
-
I’m having an issue where, when I load this site (https://www.myronmoskovitz.com) for the first time in a browser — or even after a period of time in the same browser session — the page breaks immediately before the call to wp_nav_menu in the header file. Viewing the source shows up to accessibility skip links, where the code promptly stops as if there as a PHP syntax error. When I am logged in, the admin dashboard doesn’t show up, either, though its space is reserved.
I would accept that I’m marginally dumb and go about fixing my obvious mistake, if it weren’t for the fact that the menu loads perfectly fine on subsequent page loads. I’d assume there is some necessary resource that is being called which is unavailable upon first load and is making the call break, but that’s just my shot in the dark.
For reference, here are my calls related to the menu:
In header.php:
wp_nav_menu( array( 'theme_location' => 'topmenu', 'depth' => 2 ) );
and in functions.php:
function register_my_menus() { register_nav_menus(array( 'topmenu' => 'Top Navigation Menu')); } add_action( 'init', 'register_my_menus' );
Regarding the structure of the menus, I’m using the Gecka Submenu plugin to automatically populate child pages for certain root items of a custom WP Menu.
I’d appreciate any help on this. If I’m doing something wrong, let me know what it is so I can fix it and avoid the issue in the future.
Thanks.
- The topic ‘wp_nav_menu breaks on initial page load; fixed on refresh’ is closed to new replies.