WordPress.org

Make WordPress Core

Changeset 19334


Ignore:
Timestamp:
11/18/11 07:00:26 (4 years ago)
Author:
azaozz
Message:

Prevent errors in assigning widgets to sidebars for themes with dynamic sidebars, props batmoo, fixes #19274

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/widgets.php

    r19119 r19334  
    6363        continue; 
    6464 
    65     if ( empty( $wp_registered_sidebars[ $sidebar_id ] ) && ! empty( $widgets ) ) { 
    66         // register the inactive_widgets area as sidebar 
    67         register_sidebar(array( 
    68             'name' => __( 'Inactive Sidebar (from previous theme)' ), 
    69             'id' => $sidebar_id, 
    70             'class' => 'inactive-sidebar orphan-sidebar', 
    71             'description' => __( 'This is a left over sidebar from an old theme and does not show anywhere on your site' ), 
    72             'before_widget' => '', 
    73             'after_widget' => '', 
    74             'before_title' => '', 
    75             'after_title' => '', 
    76         )); 
     65    if ( !isset( $wp_registered_sidebars[ $sidebar_id ] ) ) { 
     66        if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar 
     67            register_sidebar(array( 
     68                'name' => __( 'Inactive Sidebar (from previous theme)' ), 
     69                'id' => $sidebar_id, 
     70                'class' => 'inactive-sidebar orphan-sidebar', 
     71                'description' => __( 'This is a left over sidebar from an old theme and does not show anywhere on your site' ), 
     72                'before_widget' => '', 
     73                'after_widget' => '', 
     74                'before_title' => '', 
     75                'after_title' => '', 
     76            )); 
     77        } else { 
     78            unset( $sidebars_widgets[ $sidebar_id ] ); 
     79        } 
    7780    } 
    7881} 
Note: See TracChangeset for help on using the changeset viewer.