Make WordPress Core

Opened 4 years ago

Closed 18 months 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: flamboyantpretender Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Customize Keywords: reporter-feedback
Focuses: Cc:


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:

                            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)

#1 @flamboyantpretender
4 years ago

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:


function echo_hey() {
    echo 'hey';


Linked it up within my functions.php, as such:

require_once( get_template_directory_uri() . '/inc/echo_hello.php');

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:

( ! ) Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-content\themes\s-master\includes\Sprout\Contact\ContactBlock.php:16) in C:\xampp\htdocs\wordpress\wp-admin\includes\misc.php on line 1114

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.

Last edited 4 years ago by flamboyantpretender (previous) (diff)

#2 @dlh
2 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?

#3 @dlh
18 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Closing for lack of feedback.

Note: See TracTickets for help on using tickets.