WordPress at a glance
function is not described

WP_Widget_Search::widget() public WP 2.8.0

Outputs the content for the current Search widget instance.

{} It's a method of the class: WP_Widget_Search{}

Hooks from the method

null. Nothing.


$WP_Widget_Search = new WP_Widget_Search();
$WP_Widget_Search->widget( $args, $instance );
$args(array) (required)
Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
$instance(array) (required)
Settings for the current Search widget instance.


Since 2.8.0 Introduced.

Code of WP_Widget_Search::widget() WP 5.7.2

public function widget( $args, $instance ) {
	$title = ! empty( $instance['title'] ) ? $instance['title'] : '';

	/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
	$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );

	echo $args['before_widget'];
	if ( $title ) {
		echo $args['before_title'] . $title . $args['after_title'];

	// Use current theme search form if it exists.

	echo $args['after_widget'];