Make WordPress Core

Opened 19 months ago

Last modified 19 months ago

#38469 new defect (bug)

wp-includes/widgets.php:1208 Undefined index: wp_inactive_widgets

Reported by: onnimonni Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: General Keywords:
Focuses: Cc:



Multiple persons can reproduce this error in our company.

After I switch themes I'll get notice about widgets.

It happens in wp-includes/widgets.php:1208

I'm using custom wp-content/install.php which doesn't add any widgets because we don't usually use them at all.

This problem gets fixed when I add this snippet in my mu-plugins:

add_action( 'init', function() {
    global $sidebars_widgets;
    if (!isset($sidebars_widgets['wp_inactive_widgets'])) {
        $sidebars_widgets['wp_inactive_widgets'] = [];

Custom install.php can be found here: https://github.com/devgeniem/better-wp-install-dropin/blob/master/install.php


$ wp core version 4.6.1

$ php -v PHP 7.0.12-1

Change History (1)

#1 @onnimonni
19 months ago

This can also be fixed by adding following line to install.php:

update_option( 'sidebars_widgets', array( 'wp_inactive_widgets' => array() ) );

We should either document this behaviour into codex or core should have fix which handles this situation automatically.

Note: See TracTickets for help on using tickets.