[wp-trac] [WordPress Trac] #38612: Infinite refresh loop in Customizer when using the filter 'theme_mod_nav_menu_locations'

WordPress Trac noreply at wordpress.org
Wed Nov 2 18:27:57 UTC 2016


#38612: Infinite refresh loop in Customizer when using the filter
'theme_mod_nav_menu_locations'
--------------------------+------------------------------
 Reporter:  Chouby        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Customize     |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by westonruter):

 @Chouby ok, I think it may be something to do with the changes done for
 #27403, but I'm having a hard time pinpointing it. In any case, for an
 immediate fix while waiting on #37032, I suggest that you modify your code
 as follows:

 {{{#!php
 <?php
 function pll_remove_theme_mod_nav_menu_locations_filter() {
         remove_filter( 'theme_mod_nav_menu_locations',
 'pll_theme_mod_nav_menu_locations' );
 }
 if ( ! is_admin() ) {
         add_filter( 'theme_mod_nav_menu_locations',
 'pll_theme_mod_nav_menu_locations' );

         // Note that WP_Customize_Manager::customize_preview_settings() is
 called at wp_footer priority 10.
         add_action( 'wp_footer',
 'pll_remove_theme_mod_nav_menu_locations_filter' );
 }
 }}}

 The problem I think is that your filter is interfering with the customizer
 filters added for nav menus. So it is important to remove your filter
 before the customizer prints out the setting values so that it doesn't get
 stuck in that infinite loop.

 Try that and let me know how you go.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38612#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list