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.
Built from https://develop.svn.wordpress.org/trunk@45798


git-svn-id: http://core.svn.wordpress.org/trunk@45609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-08-14 23:03:55 +00:00
parent 0e1343ee2b
commit cc8e05df39
2 changed files with 8 additions and 1 deletions

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45797';
$wp_version = '5.3-alpha-45798';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -1125,6 +1125,13 @@ function the_widget( $widget, $instance = array(), $args = array() ) {
$instance = wp_parse_args( $instance );
/** This filter is documented in wp-includes/class-wp-widget.php */
$instance = apply_filters( 'widget_display_callback', $instance, $widget_obj, $args );
if ( false === $instance ) {
return;
}
/**
* Fires before rendering the requested widget.
*