Support » Fixing WordPress » PHP error in widget: can not remove

  • Hello,
    I just put a piece of PHP code into a text widget that is apparently supposed to display some links for a link exchange service. Due to the PHP code itself (I have exec-php and another plugin that allows PHP code in text widgets) it has caused an error. Now, when I goto the Widget Editing area there are PHP errors where I’m supposed to click “Edit” and “Remove”, there is just error text where the widget is supposed to be. I’ve tried searching for a manual way to remove widgets but to no avail. I have also tried looking in the MySQL database for where the widgets might be stored but found nothing. If someone could tell me where the widget data is stored maybe I could manually delete that specific widget. Any help would be greatly appreciated as my blog is spitting out errors to my viewers.


Viewing 3 replies - 1 through 3 (of 3 total)
  • Look for widget configuration information in the wp_options table–those rows will have ‘widget_’ in the option_name column.


    I am having a similar problem with a website and I thought I might post about it here in case anyone might have the same problem at some point.

    I had by accident put some text/code that I did not mean to into one of my text widgets. The next thing I know the website gives me the following error…

    Warning: array_keys() [function.array-keys]: The first argument should be an array in MYWEBSITEURL/wp-includes/widgets.php on line 676

    Warning: Invalid argument supplied for foreach() in MYWEBSITEURL/wp-includes/widgets.php on line 676

    Warning: Cannot modify header information – headers already sent by (output started at MYWEBSITEURL/wp-includes/widgets.php:676) in MYWEBSITEURL/wp-includes/pluggable.php on line 694

    And the error is the only thing that was showing on my MYSITE/wp-admin admin login page, thus locking me out of the admin panel.

    Now in the case of a broken plugin the solution could have been simple. delete the plugin’s folder from plugins in my wordpress installation’s files. done.
    But what do you do when a widget breaks your site?

    This problem seems to be rather rare. I could not find other mentions of it.

    I found this thread when googling for “removing widget data from database wordpress”

    I had already figured out the answer MichaelH gave but was having trouble figuring out what widget data wordpress stores/doesn’t store in the database because I did not find the data I thought was breaking our website in the table&column wp_options / widget_text

    I even tried emptying and restoring (from a backup copy) the entire wp_options table from the database hoping that that would solve the problem. But it didn’t 🙁

    Right now I am at a lost. Any ideas?

    I will be making backups of the entire current site (core files and database).
    I might do a complete restore from an old backup. I need to make sure I don’t lose any post/page data.
    but I still love you wordpress!


    I win the idiot-of-the-day award…

    I was looking in the wrong database… 🙁

    I figured this out when I could not find any of those posts I wanted to backup.

    I had made a copy of the website when I was first building it so that I could test out changes etc. And it was the databse for this site that I went into and could not find the offending widget_text data.

    Of course I couldn’t find it, it was in the other database!! stupid.

    Anyway. all better now.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP error in widget: can not remove’ is closed to new replies.