Not sure what you’re after here, another options maybe possible, but there’s e.g. this hook:
/**
* Filters a widget's settings before saving.
*
* Returning false will effectively short-circuit the widget's ability
* to update settings.
*
* @since 2.8.0
*
* @param array $instance The current widget instance's settings.
* @param array $new_instance Array of new widget settings.
* @param array $old_instance Array of old widget settings.
* @param WP_Widget $this The current widget instance.
*/
$instance = apply_filters(
'widget_update_callback',
$instance,
$new_instance,
$old_instance,
$this
);
Here’s an example how we can target Text widgets and modify the text
input field, when they are updated:
add_filter( 'widget_update_callback', function( $instance, $new, $old, $obj )
{
if( 'text' === $obj->id_base && ! empty( $instance['text'] ) )
{
// Warning this overrides the widget instance text input:
// $instance['text'] = 'override text';
}
return $instance;
}, 10, 4 );