[wp-trac] [WordPress Trac] #34226: Add 'widget_display_callback' filter to the_widget()

WordPress Trac noreply at wordpress.org
Thu Oct 8 22:11:34 UTC 2015


#34226: Add 'widget_display_callback' filter to the_widget()
-------------------------+-----------------------------
 Reporter:  MarcGuay     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Widgets      |    Version:  4.3.1
 Severity:  normal       |   Keywords:
  Focuses:  template     |
-------------------------+-----------------------------
 When a widget is output through a registered sidebar it passes through the
 'widget_display_callback' filter (see 'display_callback' in 'wp-
 includes/widgets.php', allowing for short-circuiting.  This is not the
 case when 'the_widget' is called, however.  This patch simply adds the
 same feature to that function.

 The reason I came across this is because I am using the
 [https://wordpress.org/plugins/display-widgets/ Display Widgets] plugin to
 hide widgets under certain circumstances.  It hooks into
 'widget_display_callback', runs some logic, and returns false if it should
 not appear.  Using 'the_widget' in a template file, I noticed that the
 widget still appeared.

 It seems logical to me that any time a widget is displayed, it should go
 through this filter.

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


More information about the wp-trac mailing list