[wp-trac] [WordPress Trac] #33442: Widgets not displayed if no $instance data is set
WordPress Trac
noreply at wordpress.org
Thu Aug 20 19:39:59 UTC 2015
#33442: Widgets not displayed if no $instance data is set
--------------------------+--------------------
Reporter: johnnyb | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.3.1
Component: Widgets | Version: 4.3
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+--------------------
Comment (by westonruter):
@GregRoss Good point on returning `false`. Perhaps then what we need to do
is make this change to Core:
{{{#!diff
/**
* Filter a widget's settings before saving.
*
* Returning false will effectively short-circuit the widget's ability
* to update settings.
*
* @since 2.8.0
*
- * @param array $instance The current widget instance's
settings.
+ * @param array|false|null $instance The current widget
instance's settings
* @param array $new_instance Array of new widget settings.
* @param array $old_instance Array of old widget settings.
* @param WP_Widget $this The current widget instance.
*/
$instance = apply_filters( 'widget_update_callback', $instance,
$new_instance, $old_instance, $this );
- if ( false !== $instance ) {
+ if ( false !== $instance && null !== $instance ) {
$all_instances[$number] = $instance;
}
}}}
Or perhaps instead of checking specifically for `false` or `null`, it
should just check if `is_array( $instance )`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33442#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list