diff --git a/src/wp-includes/widgets/class-wp-widget-block.php b/src/wp-includes/widgets/class-wp-widget-block.php
index 44534c7fa8..40ebae89c8 100644
a
|
b
|
class WP_Widget_Block extends WP_Widget { |
59 | 59 | public function widget( $args, $instance ) { |
60 | 60 | $instance = wp_parse_args( $instance, $this->default_instance ); |
61 | 61 | |
62 | | echo str_replace( |
63 | | 'widget_block', |
64 | | $this->get_dynamic_classname( $instance['content'] ), |
65 | | $args['before_widget'] |
66 | | ); |
67 | | |
68 | 62 | /** |
69 | 63 | * Filters the content of the Block widget before output. |
70 | 64 | * |
… |
… |
class WP_Widget_Block extends WP_Widget { |
74 | 68 | * @param array $instance Array of settings for the current widget. |
75 | 69 | * @param WP_Widget_Block $widget Current Block widget instance. |
76 | 70 | */ |
77 | | echo apply_filters( |
| 71 | $content = apply_filters( |
78 | 72 | 'widget_block_content', |
79 | 73 | $instance['content'], |
80 | 74 | $instance, |
81 | 75 | $this |
82 | 76 | ); |
83 | 77 | |
84 | | echo $args['after_widget']; |
| 78 | // only output content if it exists, this prevents empty boxes on pages. |
| 79 | if ( ! empty( $content ) ) { |
| 80 | |
| 81 | echo str_replace( |
| 82 | 'widget_block', |
| 83 | $this->get_dynamic_classname( $instance['content'] ), |
| 84 | $args['before_widget'] |
| 85 | ); |
| 86 | |
| 87 | echo $content; |
| 88 | |
| 89 | echo $args['after_widget']; |
| 90 | |
| 91 | } |
| 92 | |
85 | 93 | } |
86 | 94 | |
87 | 95 | /** |