WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#8339 closed defect (bug) (fixed)

Widget option issue

Reported by: Denis-de-Bernardy Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Administration Keywords:
Focuses: Cc:

Description

I've traced a weird bug on my theme, whose sidebars differ depending on the layout.

Basically, the sidebars_widgets options was getting updated properly but was then rendered broken on the next page load.

I've traced it down to the code in wp_get_sidebars_widgets() and wp_set_sidebars_widgets(). The array version gets unset in wp_get_sidebars_widgets(), but you forget to re-add it in wp_set_sidebars_widgets().

I've added this fix on my end until you fix the bug:

#
# fix WP widgets
#

function fix_wp_widgets($o)
{
	if ( !isset($o['array_version']) ) $o['array_version'] = 3;
	return $o;
}

add_filter('update_sidebars_widgets', 'fix_wp_widgets');

It would obviously be better to fix the wp_set_sidebars_widgets() instead.

D.

Change History (1)

comment:1 ryan5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [9888]) Make sure widgets array version is set. fixes #8339

Note: See TracTickets for help on using tickets.