Title: Warning: array_keys() [function.array-keys]:
Last modified: August 19, 2016

---

# Warning: array_keys() [function.array-keys]:

 *  Resolved [thedailymatters](https://wordpress.org/support/users/thedailymatters/)
 * (@thedailymatters)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/)
 * Warning: array_keys() [function.array-keys]: The first argument should be an 
   array in /home/ymaindomain/public_html/mydomain/wp-includes/widgets.php on line
   676
 * Warning: Invalid argument supplied for foreach() in /home/mymaindomain/public_html/
   mydomain/wp-includes/widgets.php on line 676
 * **What could this error mean? I got this after adding some code to my widget 
   Please help. ASAP**

Viewing 15 replies - 1 through 15 (of 41 total)

1 [2](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/2/?output_format=md)

 *  [philnet](https://wordpress.org/support/users/philnet/)
 * (@philnet)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751659)
 * I got the same message after a blog migration. I don’t even touched a file…
 * Plz help!
 *  [marceldekorte](https://wordpress.org/support/users/marceldekorte/)
 * (@marceldekorte)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751707)
 * And here is another one with the same problem
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751709)
 * This is due to the text widget not having the right kind of data in it. A lot
   of people get it after upgrading for some reason.
 * If you go and edit all your text widgets and then save changes, this should go
   away. Worst case, manually edit your database, find the widget_text row in wp_options,
   and remove it. Then put your text widgets back.
 *  [ronchicago](https://wordpress.org/support/users/ronchicago/)
 * (@ronchicago)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751738)
 * wow, lucky i found you. a problem for days! here is what caused error to appear.
   i upgraded from v2.1.1 with a load of plugs/widgets using sidebar widgets. i 
   deleted all the plugins prior to the upgrade because i was locked out of admin
   = this forced me into upgrading to 2.5 = no problems.
 * once 2.5 was up i added plugins “wp-gbcf” “sidebar widgets” “simple tagging” “
   simple tagging widget” well i could not see a lot of my widget_text content from
   v2.1.1 and deactivated “all plugs” = the aforementioned error.
 * now to figure out the new widget setup as my prior setup had a lot of text widgets
   including php variety. thanks again otto!
 *  [lpantos](https://wordpress.org/support/users/lpantos/)
 * (@lpantos)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751751)
 * thanks. I just went into widgets.php and clicked save changes and I’m set. Weird
   but great
 *  [lpantos](https://wordpress.org/support/users/lpantos/)
 * (@lpantos)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751752)
 * I spoke too soon. It allowed me to view the blog but there are still errors at
   the top of the page and I get the errors when I try to get into the admin section.
 *  [maery](https://wordpress.org/support/users/maery/)
 * (@maery)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751754)
 * i got the same problem in [http://www.abk-redemptoristen.de](http://www.abk-redemptoristen.de)
 * my update was really risky: from 2.0.somewhat to 2.5.1 (german). afterwards i
   got all these kind of error messages from above and i am not able to login to
   the adminpanel. the widget row is not there in the db and i cannot reach the 
   widget.php…
 * some help out there?
 *  [paninikathy](https://wordpress.org/support/users/paninikathy/)
 * (@paninikathy)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751762)
 * Same thing happened to me after I just added a new text widget. Now all my widgets
   have disappeared (except the ones that came with my cutline theme) and error 
   messages are appearing at the top of the page on my live blog (not good!) and
   in the admin panel.
 * I just moved over to wordpress 1 week ago from blogger, so I’m very new at making
   backend changes on this platform. Some step-by-step guidance would be much appreciated–
   thank you!
 *  [duluoztrip](https://wordpress.org/support/users/duluoztrip/)
 * (@duluoztrip)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751763)
 * I am new to this as well, I am getting the same error message and cannot login
   to my control panel at all… here is the problem [http://www.yourmusicsucks.com](http://yourmusicsucks.com/)
   It happened after I tried to add a new text widget. Any help would be appreciated,
   thanks!!!
 *  [ansong](https://wordpress.org/support/users/ansong/)
 * (@ansong)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751820)
 * I received the same error as you guys upgrading from 2.5 to 2.5.1.
 * > Warning: array_keys() [function.array-keys]: The first argument should be an
   > array…
 * I narrowed it down to this line from the newer wp-config.php:
 * `define('DB_CHARSET', 'utf8');`
 * I use dreamhost, maybe they’re not using utf8? In any case, after removing that
   line, all was well. I hope this helps someone.
 *  [waterhead37](https://wordpress.org/support/users/waterhead37/)
 * (@waterhead37)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751829)
 * I have the same problem although it didn’t happen immediately upon upgrading.
 * I can’t log in as admin and thus cant try some of the solutions offered. I checked
   my config file and because I haven’t changed it through several upgrades of WordPress
   it didn’t have the line
 * define(‘DB_CHARSET’, ‘utf8’);
 * at all. When I ftp’d the newer version across with this line in it, I still had
   the problems plus an accented word in my most recent post was suddenly showing
   garbage. I am wondering if the problem has to to with accented text in some way?
 * I am not sure what to try next.
 * This issue is NOT resolved
 *  [Luffy](https://wordpress.org/support/users/luffy/)
 * (@luffy)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751844)
 * After a restore of my database locally, I get the error.
    To fixed it, I went
   to the widget panel and changed all the text in widget title. I fixed the error
   message, but now I can’t change the widget title (Recent Post for example still
   keep ‘5’ as title, each time I change the title and press Save Changes, the title
   is ‘5’ ).
 * Luffy
 *  [Luffy](https://wordpress.org/support/users/luffy/)
 * (@luffy)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751845)
 * I’ve found my problem :
    1) There was a difference between my two database. The
   first was UTF-8 Unicode (utf8) and latin1_leneral_ci, but the second was UTF-
   8 Unicode (utf8) and utf8_bin. 2) When I’ve imported the data from the first 
   base to the second the character of the sql file was set to utf8 instead of latin1.
 * So I did the following :
    Set my second database to UTF-8 Unicode (utf8) and 
   latin1_leneral_ci. Choose latin1 character set during the backup importation 
   on the second base.
 * If you ve yhe same error take a look on the character paramters of your new database,
   and you’ll find the solution.
 * Hope it’ll help somebody.
 * Luffy.
    (WORDPRESS 2.5)
 *  [1hkcook](https://wordpress.org/support/users/1hkcook/)
 * (@1hkcook)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751848)
 * hi, newbie here but wordpress user since day1. problem (a silly one) but still
   problem. I tried to read through here but cannot find a thread to help. hence
   i post. my 3rd party widgets have disappeared completely, warning message flash
   above wordpress dashboard. How to fix it when I cannot even find the widget i
   need to remove.
 * Warning: array_keys() [function.array-keys]: The first argument should be an 
   array in /home2/childhoo/public_html/wp-includes/widgets.php on line 676
 * Warning: Invalid argument supplied for foreach() in /home2/childhoo/public_html/
   wp-includes/widgets.php on line 676
 * this is basically it. if i am in the wrong room here, please redirect me to the
   right forum room.
 * [http://www.childhoodspeech.com](http://www.childhoodspeech.com)
 *  [jeannedb](https://wordpress.org/support/users/jeannedb/)
 * (@jeannedb)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/#post-751850)
 * Same problem but I was already using 2.5.1. I added the following as a text widget:
 * `<p align=”center”><a href=”http://www.5minutesforspecialneeds.com” mce_href=”
   http://www.5minutesforspecialneeds.com”><img src=”http://www.5minutesforparenting.
   com/wp-content/uploads/2008/07/special-needs-125×125-1.png” mce_src=”http://www.
   5minutesforparenting.com/wp-content/uploads/2008/07/special-needs-125×125-1.png”
   alt=”5 Minutes for Special Needs” class=”alignnone size-full wp-image-19″ height
   =”125″ vspace=”10″ width=”125″></a>`
 * I assumed this would be the solution since it happened IMMEDIATELY after adding
   code in a text widget:
 * > This is due to the text widget not having the right kind of data in it. A lot
   > of people get it after upgrading for some reason.
   > If you go and edit all your text widgets and then save changes, this should
   > go away. Worst case, manually edit your database, find the widget_text row 
   > in wp_options, and remove it. Then put your text widgets back.
 * But the widget_text row isn’t even showing up in wp_options. All of my text widgets
   disappeared.
 * **UPDATING AS I’M POSTING – **
 * When I tried to add a new Text Widget as a test, I lost the whole site and only
   the error message showed. I backed into my control panel and removed the test
   Text Widget and now everything is back with the exception of all my previous 
   Text Widgets (gone forever I assume – oh well).
 * I just tried another test Text Widget and it worked fine.
 * So apparently, there is something in that code that caused my Text Widgets to
   go Kaflooey (the code is being distributed by another WordPress blog to be used
   to post their ad. I will be informing them). I included the code because I thought
   someone might know why it screwed things up.

Viewing 15 replies - 1 through 15 (of 41 total)

1 [2](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/2/?output_format=md)

The topic ‘Warning: array_keys() [function.array-keys]:’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 41 replies
 * 36 participants
 * Last reply from: [ldelre](https://wordpress.org/support/users/ldelre/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751915)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
