[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
Tue Nov 1 20:39:32 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 | Keywords:
Focuses: |
--------------------------+-----------------------------
In a multilingual plugin, we need to filter the navigation menu outputted
by the theme.
In Polylang, I am thus using the filter `theme_mod_nav_menu_locations` to
populate the theme locations with the nav menus in the correct language.
Recent changes made to the customizer in WP 4.7 beta1 seem to introduce a
backward compatibility issue as using this filter is now causing an
infinite refresh loop in the customizer.
Here is a snippet to reproduce:
{{{
if ( ! is_admin() ) {
add_filter( 'theme_mod_nav_menu_locations',
'pll_theme_mod_nav_menu_locations' );
}
function pll_theme_mod_nav_menu_locations( $menus ) {
if ( is_array( $menus ) ) {
foreach ( $menus as $loc => $menu ) {
$menus[ $loc ] = 19; // some existing menu_id
}
}
return $menus;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38612>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list