WP_Widget_Archives::update()
Handles updating settings for the current Archives widget instance.
Метод класса: WP_Widget_Archives{}
Хуков нет.
Возвращает
Массив
. Updated settings to save.
Использование
$WP_Widget_Archives = new WP_Widget_Archives(); $WP_Widget_Archives->update( $new_instance, $old_instance );
- $new_instance(массив) (обязательный)
- New settings for this instance as input by the user via WP_Widget_Archives::form().
- $old_instance(массив) (обязательный)
- Old settings for this instance.
Список изменений
С версии 2.8.0 | Введена. |
Код WP_Widget_Archives::update() WP Widget Archives::update WP 6.6.2
public function update( $new_instance, $old_instance ) { $instance = $old_instance; $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '', ) ); $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['count'] = $new_instance['count'] ? 1 : 0; $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0; return $instance; }