Opened 7 years ago
Closed 5 years ago
#43625 closed defect (bug) (invalid)
When there are invalid items in a menu, the customizer enters an infinite loop of refreshing when trying to render wp_nav_menu.
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Customize | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
I had an issue where I echoed certain things on the homepage.
Strangely enough, removing that part of code fixed it, but adding something that would 'echo' things out broke it again.
Long story short, I decoupled every single thing in my theme and discovered that when you call wp_nav_menu
, like so:
<?php wp_nav_menu( array( 'theme_location'=> 'menu-1', 'menu_id' => 'primary-menu', 'menu_class' => 'menu szWeo1-unique-menu', 'container' => 'false' ) );
but there are invalid items (removed pages or so, I believe) within that menu, the Customizer enters an infinite refresh loop and it tries to re-render that menu, but gets stuck, aborts and repeats.
Replication should be easy, simply create an item in the menu that corresponds to a page, then delete that page. This should render the item within the menu "invalid". I can't exactly say that this will work, but please do contribute if you know a way of rendering these items invalid in a consistent way.
Change History (3)
#2
@
5 years ago
- Focuses javascript administration removed
- Keywords reporter-feedback added
- Version 4.9.5 deleted
I've not been able to replicate this behavior on a fresh installation. @flamboyantpretender, are you still able to replicate it using a default theme and with no plugins activated? If so, which theme, and what are the steps that cause it?
Update: Can confirm, adding a page link to the menu and then later on removing that page renders a menu item "invalid".
Update2: It seems the error is actually triggered by calling another outer file that echoes something, but the error gets fixed by removing the invalid menu item.
I created a new file:
Linked it up within my functions.php, as such:
Then, within my header.php (or really anywhere), I called it:
This printed the 'hey' but sent the Customizer into the refresh loop and generated this error at times:
Keep in mind that this is with output_buffering set to Off in the php.ini file, but if we allow a buffer of, say, 4096, this error dissapears, but the refresh bug still happens if we have an invalid menu item - but gets fixed if we remove the invalid menu item, as I've stated before.