You don’t have to be a programmer to enjoy the myriad benefits and virtues of WordPress, but every once in a while you may try something seemingly innocuous only to discover that you are suddenly faced with some very programmer-like message.
Look at the bright side – there is usually an easy fix and you will be able to feel like an extreme coder for solving it!
The following message may appear after a WordPress update or, more often than not, from copy and pasting a code snippet from some blog directory into that ever powerful open space that is the Text widget.
Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/maindomain/public_html/mydomain/wp-includes/widgets.php on line 676
Although there is no easy explanation about what the cause of this problem might be (it can be a variety of issues), it likely has something to do with a funky piece of code that your database didn’t like.Â The problem is your blog is very unhappy now and you just want to go back to the way things were before the problem started.
This is one of those cases where the objective is not to understand why, but rather how to get back to the way things were before the problem started.
First the bad news – you may lose any custom code you entered in your various widgets in the form of php, html and text.
The good news is that not all is lost: with a few simple steps you should be back up and running in no time.
Using your FTP client as discussed in my previous troubleshooting article
, navigate to your root folder of your WordPress installation and find the file called wp-config.php
Click to view/edit, or save it to your desktop and open it in Notepad or a proper code editor like Dreamweaver.
If you take a look, a few lines down you should see the following lines:
define('DB_CHARSET', 'utf8'); define('DB_COLLATE', '');
What you want to do is to remove (“REM”) these statements out by adding a pair of slashes in front of each line so it looks like this:
// define('DB_CHARSET', 'utf8'); // define('DB_COLLATE', '');
Save the file and upload it (overwrite) to your root folder where you found it.
Now log back into your WordPress site and open up any text or php widgets and copy the code therein to your Notepad so that you can add them back in later.Â If you know what code caused the problem, avoid putting this back in after this fix.Â That is bad code.Â Bad.Â It will sleep in the dog house tonight.
Now remove those plugins and save your widget sidebar.
Things should go more or less back to normal.
Now go back to the file you edited on your desktop and remove the slashes you added in front of the two lines you found in the wp-config.php file.
Save and reupload (overwrite) the file back to your root directory on the server.
Now you can go back and recreate the custom text widgets, copying and inserting the code you have waiting for you in your Notepad.
For further notes on this issue see the following support forum at WordPress.
Photo by Evil Erin