is_active_widget() should skip orphaned widgets.

props Ninos Ego.
fixes #28810.

git-svn-id: https://develop.svn.wordpress.org/trunk@29064 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2014-07-10 15:48:54 +00:00
parent 52aa1804e4
commit 126b248fa0

View File

@@ -1142,8 +1142,9 @@ function is_active_widget($callback = false, $widget_id = false, $id_base = fals
if ( is_array($sidebars_widgets) ) {
foreach ( $sidebars_widgets as $sidebar => $widgets ) {
if ( $skip_inactive && 'wp_inactive_widgets' == $sidebar )
if ( $skip_inactive && ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) ) {
continue;
}
if ( is_array($widgets) ) {
foreach ( $widgets as $widget ) {
@@ -1424,8 +1425,9 @@ function retrieve_widgets( $theme_changed = false ) {
}
foreach ( $_sidebars_widgets as $sidebar => $widgets ) {
if ( 'wp_inactive_widgets' == $sidebar || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) )
if ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) {
continue;
}
if ( !in_array( $sidebar, $registered_sidebar_keys ) ) {
$_sidebars_widgets['orphaned_widgets_' . ++$orphaned] = $widgets;