WP_Widget_Archives::update() – Handles updating settings for the current Archives widget instance.

You appear to be a bot. Output may be restricted

Description

Handles updating settings for the current Archives widget instance.

Usage

$array = WP_Widget_Archives::update( $new_instance, $old_instance );

Parameters

$new_instance
( array ) required – New settings for this instance as input by the user via WP_Widget_Archives::form().
$old_instance
( array ) required – Old settings for this instance.

Returns

array Updated settings to save.

Source

File name: wordpress/wp-includes/widgets/class-wp-widget-archives.php
Lines:

1 to 16 of 16
  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;
  }
 

 View on GitHub View on Trac