I have a WP site up and running for my wife and she attempted to install a text widget that linked to her Twitter account (she says HTML was taken from Twitter.com). I am not sure exactly what she did or what was going on, but now she gets the following error when going to /wp-admin of the site:

WordPress database error Array for query INSERT INTO `wp_options` (`option_name`, 
`option_value`, `autoload`) VALUES ('widget_text', 'a:2:{i:2;a:0:{}
s:12:"_multiwidget";i:1;}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES\
(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES
(`autoload`)--SERIALIZED made by require_once, require_once, require_once, 
require_once, do_action, call_user_func_array, wp_widgets_init, do_action, 
call_user_func_array, WP_Widget_Factory->_register_widgets, WP_Widget->_register, 
WP_Widget->get_settings, wp_convert_widget_settings, update_option, add_option 

I have no idea what this even means. I am running WP on a Windows Server 2008 installation with SQL Server 2008. If you need more information, I will be glad to supply it. I really am not sure how to recover her site from this.


Edit: This site has been running fine for a month now and just now blew up after adding the text widget and adding the Twitter HTML.

Edit 2: I found the offending JavaScript in the wp_options (widget_text) and removed it but am still receiving the same error listing on the admin page.

  • What happens if you remove that widget folder and related files? Do you still get an error?
    – Jin
    Commented Feb 24, 2011 at 6:30
  • @Jin - I don't see a widgets folder anywhere in the installation. I have gone through each level a few times (and did a Windows search) looking for it, too. Commented Feb 24, 2011 at 6:35
  • under /wp-content/plugins/, do you see the folder for the twitter widget?
    – Jin
    Commented Feb 24, 2011 at 6:48
  • @Jin - No--it's not a Twitter widget but just an HTML widget (built in, I believe) with Twitter HTML pasted in. Commented Feb 24, 2011 at 6:50

3 Answers 3


ON DUPLICATE KEY UPDATE is one of several MySQL-specific things used by WP. Best I'm aware there is no equivalent in SQL-Server. You'll get a syntax error no matter unless you regexp_replace() every query sent to the DB server in order to rewrite the SQL as needed for your specific engine.

  • After getting some sleep last night and having fresh eyes this morning, I noticed the same thing. I think there is something wrong with the SQL Server beta installation. I am going to check to see if they have a newer version, otherwise it's back to MySql, I suppose. Thanks, again. Commented Feb 24, 2011 at 20:13

Typically, I find these issues are related to database rights. Check the security for the DB and the user. Sorry, that's all I've got. - Mike

  • fancy meeting you here! This WP site has been running for a while and it was just after adding the text widget that it blew up. I will take a look, though, and see if something might have changed. Thanks for the response! ~Jim Commented Feb 24, 2011 at 5:24
  • just checked and permissions are good. I have DB_Owner and even reader/writer just to be safe--still no dice. ~Jim Commented Feb 24, 2011 at 5:26

Open your favorite SQL frontend...find the wp_options table. Search for the sidebar_widgets key. You'll find a serialized array in the option_value.

You can either try identifying which one is the malicious text widget in question and hand-remove it from the serialized array (which requires you to be able to interpret/rewrite serialization), or just wipe the whole option_value field.

That will hopefully give you access to admin again and you can then reconfig your widgets.

Edit: second approach: Ok...try this instead: look for widget_text. Again, you'll find a big serialized array. You'll find a pattern in there like this: a:3:{s:5:"title";s:...:".......";s:4:"text";s:...:"........" Each of those is the beginning of the definition of one of your text widgets. Find the one that looks like the twitter one and erase everything between the quotation marks of the text part (that is the fourth set of quotation marks in the above pattern).

  • @wyrfel - Doing so gave me a string of errors like the following (where "FILE LOCATION" is the location of the incriminating file): PHP Warning: array_key_exists() expects parameter 2 to be array, string given in "FILE LOCATION" on line 852 Commented Feb 24, 2011 at 8:01
  • @wyrfel - I set the column data back and the website came back up (dropping the data in that column killed the entire installation). Commented Feb 24, 2011 at 8:02
  • @jdangelo Sorry, you probably should have left an a:0:{} in there, then. Give me a moment.
    – wyrfel
    Commented Feb 24, 2011 at 8:08
  • @wryfel - I found the JavaScript in widget_text and cleared out everything between the quotes, but still got the same error. (I do appreciate the help!) Commented Feb 24, 2011 at 8:11
  • @jdangelo: In that case i'm a bit lost...if it is really due to the twitter widget, it may have messed up something else. You could try searching the options table for twitter keys. Or try running the query you posted above and check for what response you get from mysql directly.
    – wyrfel
    Commented Feb 24, 2011 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.