WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Warning: array_keys() [function.array-keys]:

[Resolved] Warning: array_keys() [function.array-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 - 16 through 30 (of 41 total)
  • 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

    Same for me here.

    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.

    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

    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

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

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

    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.

    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….

    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.

    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.

    DomainClaimers

    @domainclaimers

    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……

    dukeofdordogne

    @dukeofdordogne

    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

    DomainClaimers

    @domainclaimers

    // 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?

    DomainClaimers

    @domainclaimers

    Update – after doing the above it did allow me to work on my website but I found no text widgets in the sidebar, it also shut down 5 other websites on the same server as mine since those are also my websites it was obvious that taking that code out is not going to fix the problem. Not sure what to try next, maybe going back in and taking the text code out of the header and deleting all comments this would leave no text errors possible, maybe upgraded or deactivate all the plug ins.

Viewing 15 replies - 16 through 30 (of 41 total)
  • The topic ‘[Resolved] Warning: array_keys() [function.array-keys]:’ is closed to new replies.
Skip to toolbar