PHP - Wordpress - Plugin Widget Update Function - Update array values [Foreach Loop not Working] PHP - Wordpress - Plugin Widget Update Function - Update array values [Foreach Loop not Working] wordpress wordpress

PHP - Wordpress - Plugin Widget Update Function - Update array values [Foreach Loop not Working]


I have found a simple solution: do not include an update function in your extension of the widget.

The core simply returns the $new_instance variable as a default (wp-includes/widgets.php):

function update($new_instance, $old_instance) {    return $new_instance;}

I have tested this with success in my own widget and have determined that making your own update function is useful for filtering user input, but it does not seem necessary.