[wp-trac] [WordPress Trac] #55448: WP_Widget_Block outputs empty container if widget has no output

WordPress Trac noreply at wordpress.org
Wed Mar 23 10:22:42 UTC 2022


#55448: WP_Widget_Block outputs empty container if widget has no output
----------------------------+-----------------------------
 Reporter:  stiofansisland  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Widgets         |    Version:  5.9.2
 Severity:  major           |   Keywords:
  Focuses:  ui              |
----------------------------+-----------------------------
 There are many widgets that for some reason or another will not output any
 content, this can be for many reasons, one example would be for a logged
 in/out user.

 When you create your own widget class you have control of the widget()
 output function and can return an empty string to prevent any output.

 The WP_Widget_Block class which is used as a sort of wrapper contains its
 own widget() class which prevents no output even if the block has no
 content.

 This has left empty boxes showing for many plugins widgets on sites and
 breaks the backward compatibility of the widgets system.

 This should be as easy fix, I will create and submit a patch soon.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55448>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list