Upgrade Wordpress Widget to use the Widget API
Hopefully开发者_开发技巧 someone can help me out with this. I am upgrading a widget from the (really) old method of get_option/update_option to store/retrieve widget options to use the newer Widget API. The goal is to be able to use multiple instances of the widget, which I have successfully done, but now I'm running into a problem.
The plugin I'm working with is currently being used on somewhere between 500 and 1000 sites, most of which have some of the plugin widgets enabled. If I commit the widget upgrades to the next release of our plugin, all sites will lose the option values and placement of existing widgets. Does anyone know of a way around this?
Looks like WordPress will take care of it for you - new widgets store a _multiwidget
key in the settings array, if it's not there, wp_convert_widget_settings()
gets on the case.
精彩评论