From fba131157e04f25ac7012ccb94a2bd0d138b2ebc Mon Sep 17 00:00:00 2001 From: Jorge Date: Fri, 22 Mar 2019 19:20:13 +0000 Subject: [PATCH] Fix. Bug Affecting Widgets without description --- lib/widgets.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/widgets.php b/lib/widgets.php index b756cce99d5222..c08d31de9f3f11 100644 --- a/lib/widgets.php +++ b/lib/widgets.php @@ -95,7 +95,12 @@ function gutenberg_legacy_widget_settings( $settings ) { if ( ! in_array( $class, $core_widgets ) ) { $available_legacy_widgets[ $class ] = array( 'name' => html_entity_decode( $widget_obj->name ), - 'description' => html_entity_decode( $widget_obj->widget_options['description'] ), + // wp_widget_description is not being used because its input parameter is a Widget Id. + // Widgets id's reference to a specific widget instance. + // Here we are iterating on all the available widget classes even if no widget instance exists for them. + 'description' => isset( $widget_obj->widget_options['description'] ) ? + html_entity_decode( $widget_obj->widget_options['description'] ) : + null, 'isCallbackWidget' => false, ); } @@ -110,7 +115,7 @@ function gutenberg_legacy_widget_settings( $settings ) { } $available_legacy_widgets[ $widget_id ] = array( 'name' => html_entity_decode( $widget_obj['name'] ), - 'description' => null, + 'description' => html_entity_decode( wp_widget_description( $widget_id ) ), 'isCallbackWidget' => true, ); }