widget_display_callback filter-hookWP 2.8.0

Filters the settings for a particular widget instance.

Returning false will effectively short-circuit display of the widget.

Usage

add_filter( 'widget_display_callback', 'wp_kama_widget_display_callback_filter', 10, 3 );

/**
 * Function for `widget_display_callback` filter-hook.
 * 
 * @param array     $instance The current widget instance's settings.
 * @param WP_Widget $widget   The current widget instance.
 * @param array     $args     An array of default widget arguments.
 *
 * @return array
 */
function wp_kama_widget_display_callback_filter( $instance, $widget, $args ){

	// filter...
	return $instance;
}
$instance(array)
The current widget instance's settings.
$widget(WP_Widget)
The current widget instance.
$args(array)
An array of default widget arguments.

Changelog

Since 2.8.0 Introduced.

Where the hook is called

WP_Widget::display_callback()
widget_display_callback
the_widget()
widget_display_callback
wp-includes/class-wp-widget.php 382
$instance = apply_filters( 'widget_display_callback', $instance, $this, $args );
wp-includes/widgets.php 1239
$instance = apply_filters( 'widget_display_callback', $instance, $widget_obj, $args );

Where the hook is used in WordPress

Usage not found.