Make WordPress Core


Ignore:
Timestamp:
08/14/2019 11:02:25 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Widgets: Allow for short-circuiting widget output in the_widget() using the widget_display_callback filter, for consistency with output via a registered sidebar.

Props MarcGuay, donmhico.
Fixes #34226.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets.php

    r45674 r45798  
    11261126    $instance = wp_parse_args( $instance );
    11271127
     1128    /** This filter is documented in wp-includes/class-wp-widget.php */
     1129    $instance = apply_filters( 'widget_display_callback', $instance, $widget_obj, $args );
     1130
     1131    if ( false === $instance ) {
     1132        return;
     1133    }
     1134
    11281135    /**
    11291136     * Fires before rendering the requested widget.
Note: See TracChangeset for help on using the changeset viewer.