WP_Widget_Recent_Posts::update()
Handles updating the settings for the current Recent Posts widget instance.
Метод класса: WP_Widget_Recent_Posts{}
Хуков нет.
Возвращает
Массив
. Updated settings to save.
Использование
$WP_Widget_Recent_Posts = new WP_Widget_Recent_Posts(); $WP_Widget_Recent_Posts->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.
Список изменений
С версии 2.8.0 | Введена. |
Код WP_Widget_Recent_Posts::update() WP Widget Recent Posts::update WP 6.7.1
public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['number'] = (int) $new_instance['number']; $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false; return $instance; }