WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Warning: array_keys() [function.array-keys]: (42 posts)

  1. thedailymatters
    Member
    Posted 6 years ago #

    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

  2. philnet
    Member
    Posted 6 years ago #

    I got the same message after a blog migration. I don't even touched a file...

    Plz help!

  3. marcel.dekorte
    Member
    Posted 6 years ago #

    And here is another one with the same problem

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  5. ronchicago
    Member
    Posted 6 years ago #

    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!

  6. lpantos
    Member
    Posted 6 years ago #

    thanks. I just went into widgets.php and clicked save changes and I'm set. Weird but great

  7. lpantos
    Member
    Posted 6 years ago #

    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.

  8. maery
    Member
    Posted 6 years ago #

    i got the same problem in 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?

  9. PaniniKathy
    Member
    Posted 6 years ago #

    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!

  10. duluoztrip
    Member
    Posted 6 years ago #

    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 It happened after I tried to add a new text widget. Any help would be appreciated, thanks!!!

  11. ansong
    Member
    Posted 6 years ago #

    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.

  12. waterhead37
    Member
    Posted 6 years ago #

    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

  13. Luffy
    Member
    Posted 6 years ago #

    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

  14. Luffy
    Member
    Posted 6 years ago #

    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)

  15. 1hkcook
    Member
    Posted 6 years ago #

    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

  16. jeannedb
    Member
    Posted 6 years ago #

    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.

  17. cheetah1
    Member
    Posted 6 years ago #

    Oh well, I got about the same errors as the OP, and another one. Can someone simply tell me what's wrong?

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/arkiv.cristianswebsite.org/wp-includes/widgets.php on line 1352
    
    Warning: Invalid argument supplied for foreach() in /var/www/arkiv.cristianswebsite.org/wp-includes/widgets.php on line 1352
    
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/arkiv.cristianswebsite.org/wp-includes/widgets.php:1352) in /var/www/arkiv.cristianswebsite.org/wp-includes/pluggable.php on line 770
  18. Anonymous
    Unregistered
    Posted 6 years ago #

    Same for me here.

  19. dorfun
    Member
    Posted 5 years ago #

    If you have this error:

    Warning: array_keys() [function.array-keys]: The first argument should be an array in [...] on line 1352

    Try to deactivate all widgets (and no only plugins). Use a widget-ready theme, deactive all them... and maybe will be ok! :)

    It works for me.

  20. totof2k2
    Member
    Posted 5 years ago #

    Hello Dorfun

    Can you tell me, how you can desactivate all widgets ? i can't acces to my admin panel...
    all Plugins are OFF,

    thanks for your help

    christophe

  21. Wiki Chaves
    Member
    Posted 5 years ago #

    Hi !

    i have the same problem ? how can i desactivate the widgets . i can´t access to my admin panel

    take a look

    http://wikichaves.com/blog/
    http://wikichaves.com/blog/wp-admin/

    thanks !
    francisco

  22. cheetah1
    Member
    Posted 5 years ago #

    Well, I have to ask the same. How do you do that when you can't access the gui?

  23. @mercime
    Volunteer Moderator
    Posted 5 years ago #

    The fastest way to de-activate widgets when you cannot access your WP admin is by deleting the plugin from FTP.

  24. davosian
    Member
    Posted 5 years ago #

    Here is how I fixed it:

    To gain access to your widget page, simply comment out two lines of your wp-config.php file:

    // define('DB_CHARSET', 'utf8');
    // define('DB_COLLATE', '');

    Then log in and go to your widget page.
    Remove each text widget and PHP widget (copy the content into a text editor so you can retrieve it afterwards again).
    Go back into your wp-config.php file and remove the comments again. Save.
    Log in and add your text widgets again. This should work fine now.

  25. beritany
    Member
    Posted 5 years ago #

    here's what comes to my blog after i tried to log-in

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

    Warning: Invalid argument supplied for foreach() in /home/beritany/public_html/wp-includes/widgets.php on line 686

    Warning: Cannot modify header information - headers already sent by (output started at /home/beritany/public_html/wp-includes/widgets.php:686) in /home/beritany/public_html/wp-login.php on line 267

    Warning: Cannot modify header information - headers already sent by (output started at /home/beritany/public_html/wp-includes/widgets.php:686) in /home/beritany/public_html/wp-login.php on line 279

    Warning: Cannot modify header information - headers already sent by (output started at /home/beritany/public_html/wp-includes/widgets.php:686) in /home/beritany/public_html/wp-includes/pluggable.php on line 595

    Warning: Cannot modify header information - headers already sent by (output started at /home/beritany/public_html/wp-includes/widgets.php:686) in /home/beritany/public_html/wp-includes/pluggable.php on line 596

    Warning: Cannot modify header information - headers already sent by (output started at /home/beritany/public_html/wp-includes/widgets.php:686) in /home/beritany/public_html/wp-includes/pluggable.php on line 597

    Warning: Cannot modify header information - headers already sent by (output started at /home/beritany/public_html/wp-includes/widgets.php:686) in /home/beritany/public_html/wp-includes/pluggable.php on line 770

    can anyone help me? i cant log in, i cant remove my widgets, and i dont even know what mistakes that i made....

  26. philsouthwark
    Member
    Posted 5 years ago #

    Same here - I added a text widget and immediately was inundated with the same error as above.

    But all the widgets disappeared at the same time so there are none to delete.

    I have tried commenting out the lines suggested. I have also tried replacing the widget.php files with originals - so far nothign has got rid of these errors - any ideas please? I have searched on this and there doesn't seem to be much help online.

  27. Laura McDonald
    Member
    Posted 5 years ago #

    hey guys, i was having this problem with a site that i migrated to a local server for development. the way i solved it was:
    - open wp-includes/widgets.php
    - go to line 686 and cut out this part (only temporarily, make sure you can put it back later!)
    ---
    foreach ( array_keys($options) as $o ) {
    // Old widgets can have null values for some reason
    if ( !isset($options[$o]['title']) || !isset($options[$o]['text']) )
    continue;
    $id = "text-$o"; // Never never never translate an id
    wp_register_sidebar_widget($id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o ));
    wp_register_widget_control($id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o ));
    }
    ---
    you will then be able to log into your site. per some people's previous instructions, i then messed around a little with my widgets, re-saved them, and then deactivated then reactivated my plugins. then i put the above code back and the site works.

    i'm not exactly sure how, but it solved the problem for me.

  28. DomainClaimers
    Member
    Posted 5 years ago #

    I can't log on to the wordpress site to edit anything, I can get into my FTP account but have no idea how to delete these lines

    // define('DB_CHARSET', 'utf8');
    // define('DB_COLLATE', '');

    That file won't let me edit anything, I have had problems with code before but never anything that wouldn't let me log onto the wp site to edit code there. I know why I hate to update WordPress, I have no idea what to try next, if this is just a text widget problem I could fix it easily if I had access to the admin panel.

    Still need help if anyone can help......

  29. dukeofdordogne
    Member
    Posted 5 years ago #

    I had the exact same problem / error, although mine was with a fresh install.
    All I did was clear my cached files and history, refreshed and the error has gone..

    Hope this helps others..

    The Duke

  30. DomainClaimers
    Member
    Posted 5 years ago #

    // define('DB_CHARSET', 'utf8');
    // define('DB_COLLATE', '');

    I put a /* before and after the above code each line, this allowed the site to come back and I was able to log onto it, now do I still need this code and what is it for?

    What does the above two lines of code do anyway?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags