WP_Widget_Recent_Comments::update()publicWP 2.8.0

Handles updating settings for the current Recent Comments widget instance.

Method of the class: WP_Widget_Recent_Comments{}

No Hooks.

Return

Array. Updated settings to save.

Usage

$WP_Widget_Recent_Comments = new WP_Widget_Recent_Comments();
$WP_Widget_Recent_Comments->update( $new_instance, $old_instance );
$new_instance(array) (required)
New settings for this instance as input by the user via WP_Widget::form().
$old_instance(array) (required)
Old settings for this instance.

Changelog

Since 2.8.0 Introduced.

WP_Widget_Recent_Comments::update() code WP 6.5.2

public function update( $new_instance, $old_instance ) {
	$instance           = $old_instance;
	$instance['title']  = sanitize_text_field( $new_instance['title'] );
	$instance['number'] = absint( $new_instance['number'] );
	return $instance;
}