0
votes

I originally wrote my Wordpress 3.0 widget http://codex.wordpress.org/Widgets_API for editing on the widget page after it has been placed in a sidebar, which handles the updating automatically using the update() function in widget. It has grown and needs a widget admin page now so outside my widget class I added another action I found http://codex.wordpress.org/Adding_Administration_Menus to add a admin_menu, so far so good (hopefully I did it using a current API method but there didn't seem to another method in the widget.php file of WP). I created the form but I don't know how to update the widget now. I've looked through the code for widgets and I'm not sure how the update function actually works. I read that you can have options and add them to the database but if they already exist I don't want to abandon that data if there's a way to keep using it. The widget will keep two fields on the widget page and the rest will be handled on the admin page.

How do I update my widget from the admin page and have it be retrieved by the widget and can that be done in such a way that it is stored in the same place as my existing widget data using WP3.0 current widget API? If not how would I go about doing it?

1

1 Answers

0
votes

The answer can be found in the "Plugin Options Starter Kit" plugin http://wordpress.org/extend/plugins/plugin-options-starter-kit/ that contains all you need to figure out how to use the settings API, adding admin menu pages and more. Can't wait to see the next update of this plugin.