The widget save function

When a user clicks on the Save button on the widget form, WordPress uses AJAX to run your save function. You need to be sure to save whatever the user types in, which is all we're doing in this case, but you can put other functionalities here if it's appropriate for your widget (for example, database interactions, conversions, calculations, and so on). The final code for this function is as follows:

public function update($new_instance, $old_instance) { 
  $instance['title'] = $new_instance['title']; 
  $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); 
  return $instance; 
}

Be sure this function is named update() and is prepared to accept two instances, one with the old data and one with the just-submitted data. You can write your code to check $new_instance for problems, and thus, return $old_instance if the new one isn't valid. The $instance data you return will be what's shown in the update widget form.