WP_Widget_Block::update()publicWP 5.8.0

Handles updating settings for the current Block widget instance.

Метод класса: WP_Widget_Block{}

Хуков нет.

Возвращает

Массив. Settings to save or bool false to cancel saving.

Использование

$WP_Widget_Block = new WP_Widget_Block();
$WP_Widget_Block->update( $new_instance, $old_instance );
$new_instance(массив) (обязательный)
New settings for this instance as input by the user via WP_Widget::form().
$old_instance(массив) (обязательный)
Old settings for this instance.

Список изменений

С версии 5.8.0 Введена.

Код WP_Widget_Block::update() WP 6.6.2

public function update( $new_instance, $old_instance ) {
	$instance = array_merge( $this->default_instance, $old_instance );

	if ( current_user_can( 'unfiltered_html' ) ) {
		$instance['content'] = $new_instance['content'];
	} else {
		$instance['content'] = wp_kses_post( $new_instance['content'] );
	}

	return $instance;
}