bunglist
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Fixing WordPress
In reply to: Widgets problemThe problem is in widgets.php
function is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) { global $wp_registered_widgets; $sidebars_widgets = wp_get_sidebars_widgets(); if ( is_array($sidebars_widgets) ) { foreach ( $sidebars_widgets as $sidebar => $widgets ) { if ( $skip_inactive && 'wp_inactive_widgets' == $sidebar ) continue; if ( is_array($widgets) ) { foreach ( $widgets as $widget ) { if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) || ( $id_base && _get_widget_id_base($widget) == $id_base ) ) { if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] ) return $sidebar; } } } } } return false; }Original:
Line 924-925 (widgets.php):if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) || ( $id_base && _get_widget_id_base($widget) == $id_base ) ) { if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] )From what this guy said about the “Nesting level too deep – recursive dependency” error I switched the comparison operators in the if statements (lines 924 and 925) from non-strict (==) to strict (===) and it reduces the amount of objects being checked to those of the same type, so all of the widgets now show up in widgets.php and no more error.
Fix:
Line 924-925 (widgets.php):
Replace the three non-strict comparison operators (==) with strict (===).
Third replacement, line 925, may not be necessaryif ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] === $callback ) || ( $id_base && _get_widget_id_base($widget) === $id_base ) ) { if ( !$widget_id || $widget_id === $wp_registered_widgets[$widget]['id'] )
Viewing 1 replies (of 1 total)