Title: [Plugin: Flexible Posts Widget] Query to update template
Last modified: August 20, 2016

---

# [Plugin: Flexible Posts Widget] Query to update template

 *  Resolved [winstonion](https://wordpress.org/support/users/winstonion/)
 * (@winstonion)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-flexible-posts-widget-query-to-update-template/)
 * Hi – thanks for you plugin, so far I have found it very useful.
    Question: I 
   built an alternate template according to your instructions, and it works, but
   I wanted to update about 25 Flexible Post Widgets to use this new template. I
   figured I could do this with an update query but it didn’t seem to work. My query:`
   UPDATE wp_options SET option_value = REPLACE(option_value,'widget.php','my_custom.
   php') WHERE option_id = 1286 and option_name = 'widget_dpe_fp_widget'`
 * It looks like the query updated the option_value string correctly but reloading
   the widgets page showed that all my sidebar widgets dropped off. I didn’t think
   there would be any problem doing this if I only touched that one portion of the
   string.
 * Any ideas?
    Thanks
 * [http://wordpress.org/extend/plugins/flexible-posts-widget/](http://wordpress.org/extend/plugins/flexible-posts-widget/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [DaveE](https://wordpress.org/support/users/dpe415/)
 * (@dpe415)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-flexible-posts-widget-query-to-update-template/#post-2843833)
 * Hi Winstonion,
 * WordPress stores widget options (and many other values) in the database as serialized
   strings. In order to update those values correctly, you’d need to unserialize
   the string, update it and then re-serialize it before replacing the value in 
   the DB.
 * When the serialized data gets corrupted (by performing a MySQL update directly
   on the serialized data) the widget or other item using that data is essentially
   ignored by WordPress. Hence, you widgets have disappeared.
 * To recover the widgets that have been lost, you _may_ be able to just re-update
   the DB value back to the initial ‘widget.php’. This may or may not work depending
   on how corrupted the data became. You could also revert to a backup of the DB
   or specific DB table if you have that.
 * Here’s a bit of an explanation from Nacin regarding WP’s serialized strings:
   
   [http://nacin.com/2010/04/18/wordpress-serializing-data/](http://nacin.com/2010/04/18/wordpress-serializing-data/)
 * And here’s a tool/PHP script that you can use to update serialized data in the
   DB:
    [http://interconnectit.com/124/search-and-replace-for-wordpress-databases/](http://interconnectit.com/124/search-and-replace-for-wordpress-databases/)
 * Hopefully that helps.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Flexible Posts Widget] Query to update template’ is closed to
new replies.

 * ![](https://ps.w.org/flexible-posts-widget/assets/icon-256x256.jpg?rev=984592)
 * [Flexible Posts Widget](https://wordpress.org/plugins/flexible-posts-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/flexible-posts-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/flexible-posts-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/flexible-posts-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/flexible-posts-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/flexible-posts-widget/reviews/)

## Tags

 * [template](https://wordpress.org/support/topic-tag/template/)

 * 1 reply
 * 2 participants
 * Last reply from: [DaveE](https://wordpress.org/support/users/dpe415/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-flexible-posts-widget-query-to-update-template/#post-2843833)
 * Status: resolved