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 11 replies - 31 through 41 (of 41 total)

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

 *  [mersh](https://wordpress.org/support/users/mersh/)
 * (@mersh)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751893)
 * I just moved my sites to an upgraded server, running identical software to the
   one they left. I should say “apparently” identical because every one of my wordpress
   blogs is fluggered…
 * [http://www.oliverbc.ca](http://www.oliverbc.ca)
    [http://www.winecapital.ca](http://www.winecapital.ca)
   [http://www.canadianwinetours.com](http://www.canadianwinetours.com)
 * All have one or another of the error discussed here. I tried removing suggested
   lines from the widgets.php file and from my wpconfig file, nothing seems to fix
   this. I have no text widgets. Help…!
 *  [mersh](https://wordpress.org/support/users/mersh/)
 * (@mersh)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751894)
 * OK I resolved the issue above… the answer to my problem was MAGIC QUOTES – once
   I turned them OFF in my php.ini (or it could be done through cpanel) all the 
   error message went away.
 *  [Famous](https://wordpress.org/support/users/famous/)
 * (@famous)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751895)
 * **What is this error?:**
    Warning: array_keys() [function.array-keys]: The first
   argument should be an array in Testing\wp-includes\widgets.php on line 1349
 * Warning: Invalid argument supplied for foreach() in Testing\wp-includes\widgets.
   php on line 1349
 *  [michaelkrol](https://wordpress.org/support/users/michaelkrol/)
 * (@michaelkrol)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751898)
 * I figured out what caused this error for me. My blog was working fine, but my
   local copy was getting the array_keys() error. It turns out it was due to an 
   issue I’ve run into many times before while exporting a database from phpMyAdmin.
 * For some reason, phpMyAdmin inserts garbage after EVERY LINK in your database
   content. So if you have a database row with `<a href="mylink">` in the data, 
   it will end up looking something like `<a href="mylink?phpMyAdmin=hxLEzQ1rOQcEE5fSSzkpIuPI8E7"
   >`. Obviously, this causes all kinds of issues.
 * The only way I’ve found to stop this behavior is to NOT check “save as file” 
   when exporting your database. Just click “Go” and let the dump print to screen.
   Then copy/paste it into a text file and import that into your local (or wherever)
   database.
 *  [borayeris](https://wordpress.org/support/users/borayeris/)
 * (@borayeris)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751899)
 * Thanx Otto
 *  [webstergroup](https://wordpress.org/support/users/webstergroup/)
 * (@webstergroup)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751902)
 * I have moved my site to a new server and now the text widgets do not work at 
   all. I had the array error after I moved it as well that is now gone BUT I can
   not use text widgets at all.
 *  [yesteryear](https://wordpress.org/support/users/yesteryear/)
 * (@yesteryear)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751904)
 * I had the same problems, getting the error message:
    Warning: array_keys() [function.
   array-keys]: The first argument should be an array in Testing\wp-includes\widgets.
   php on line 1044
 * Warning: Invalid argument supplied for foreach() in Testing\wp-includes\widgets.
   php on line 869
 * Turns out it’s an error you get when importing from a database using a different
   utf.
    My brother managed to fix the problem by deleting the following code in
   wp-config.hp: /** Database Charset to use in creating database tables. */ define(‘
   DB_CHARSET’, ‘utf8’);
 * Good luck to others with the same problem!
 *  [vlads](https://wordpress.org/support/users/vlads/)
 * (@vlads)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751909)
 * Had the same problem after migrating to a new server. The problem was character
   encoding. Make sure to use utf-8 encoding when exporting/importing your database
   via phpMyAdmin, CocoaMySQL, etc.
 *  [esb](https://wordpress.org/support/users/esb/)
 * (@esb)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751912)
 * Please someone help!
 * I’m getting this error as well so many others while trying to figure out what
   I did wrong.
 * I added some html into my text box widget and the next thing I know every page
   has an error. So I look for a solution and find the deal on how to edit the wp-
   config for it. This only made it to where I can no longer access my wp-admin 
   or my website. I’m seriously freaking out. I’ve tried every solution I’ve been
   able to google and still no luck.
 * `Parse error: syntax error, unexpected '*' in /home/elibrumb/public_html/artstormhouston.
   com/wp-config.php on line 2`
 * This is the current error message.
 *  [the-general](https://wordpress.org/support/users/the-general/)
 * (@the-general)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751913)
 * Like all of you that wrote in I had this problem as well. I went through and 
   tried the many suggestions posted here and managed to really screw things up 
   bad.
 * So bad that a two year old site defaulted to a new installation!! I was mad as
   heck!!
 * I went back through this and noticed that someone had thanked Otto42. So I went
   and looked at what he wrote. It seems like the first time I read his reply I 
   missed it.
 * > 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.
 * This solved the problem. Before trying anything else please try this first!
 * Thank you Otto42!
 *  [ldelre](https://wordpress.org/support/users/ldelre/)
 * (@ldelre)
 * [17 years ago](https://wordpress.org/support/topic/warning-array_keys-functionarray-keys/page/3/#post-751915)
 * This worked for me:
 * wp-options > option_name > widget_text
 * Removed the widget_text, as advised.

Viewing 11 replies - 31 through 41 (of 41 total)

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

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
