Add custom data (field) to sidebar widgets for later display

Crude code. I have never tried this but I can get you part of the way there.

Add a field…

add_action(
  'in_widget_form', 
  function ($instance) {
    echo '<input type="text" value="c00l" />';
    return null;
  },
  1
);

And there is a hook that runs on settings update.

add_filter(
  'widget_update_callback', 
  function($instance, $new_instance, $old_instance, $this) {
    var_dump($instance, $new_instance, $old_instance, $this); die;
  },
  1,4
);

However, it looks like you need to add an option/setting to the widget before that hook will work and I don’t see how to do that. I am probably missing something obvious but don’t have time to do more research right now.

Reference

http://core.trac.wordpress.org/browser/trunk/src/wp-includes/widgets.php

error code: 523