WordPress Plugin List Corruption

March 24, 20096 Comments

If you see something like the line below at the top of your plugin list in WordPress, it probably means there’s some corruption in your Active Plugin array.  The array is stored in the {wp}_options table under the option_key of “active_plugins”

 Warning: Illegal offset type in {yoursite}\wp-admin\includes\plugin.php on line 456

The code below will fix this problem and leave all of your active plugins intact.

 

Hello Dolly

Hello Dolly is a great little plugin that I’m sure you’re using right now.  Since it’s already loaded and ready to go, it’s easy to add a little code to this plugin, activate it, and let it make our corrections.

On the plugin editor page, open Hello Dolly.  Locate the lines below and add the lines in blue.  Save the file.  Go to the Plugin Installation page and activate the Hello Dolly plugin.  You may need to click on a link so that the code will run.  The error messages should disappear and all will be good again.  Be sure to deactivate Hello Dolly and remove the code.  That’s it!

...
// This just echoes the chosen line, we'll position it later
function hello_dolly() {
	$chosen = hello_dolly_get_lyric();
        echo "<p id='dolly'>$chosen</p>";
  
        sw_plugins_fix(); //Copy This Line
} //Don't Copy this line. (It's already there.)

//Copy all of these lines.
function sw_plugins_fix() {
	$current = get_option('active_plugins');
        $fixed = array();
        foreach ( $current as $plugin ) {
            if(!is_array($plugin))
            {
               array_push($fixed,$plugin);
            }
	}
	update_option('active_plugins', $fixed);
}
...
Share

4 Responses to “WordPress Plugin List Corruption”

  1. Twitter Comment


    @ikepigott @jangles – Here’s the fix for the WordPress Plugin List Corruption – [link to post]

    – Posted using Chat Catcher

  2. Ike Pigott says:

    Ah… one tweak to make it more readable:

    The closing bracket above this line:

    sw_plugins_fix();

    is BLACK, and is the closing bracket that comes after $chosen”; in Hello Dolly.

    So the

    sw_plugins_fix();

    needs to be INSERTED between that closing bracket and the $chosen line.

    THEN… AFTER that closing bracket, insert all this code:

    function sw_plugins_fix() {
    $current = get_option(‘active_plugins’);
    $fixed = array();
    foreach ( $current as $plugin ) {
    if(!is_array($plugin))
    {
    array_push($fixed,$plugin);
    }
    }
    update_option(‘active_plugins’, $fixed);
    }

    \\ That one black pre-existing bracket is too easy to copy, and doesn’t stand out against the blue text. \\

    But THANK YOU, it DOES WORK!

  3. swhitley says:

    Thanks, Ike. I added some additional comments. Hope that will help others.

  4. Twitter Comment


    @swhitley @ikepigott that is excellent, Shannon. I see from the post that it works for you, Ike. [link to post] Me next!

    – Posted using Chat Catcher

  5. And it works! Thanks Shannon.

    (Btw, 1st try with your Twitter Connect plugin. Nice.)

  6. Zashkaser says:

    Very Interesting post! Thank you for such interesting resource!PS: Sorry for my bad english, I’v just started to learn this language

Leave a Reply

Twitter Tweet This

2 Trackbacks

  1. swhitley (Shannon Whitley)

    Twitter Comment


    @ikepigott @jangles – Here’s the fix for the WordPress Plugin List Corruption – [link to post]

    – Posted using Chat Catcher

  2. jangles (Neville Hobson)

    Twitter Comment


    @swhitley @ikepigott that is excellent, Shannon. I see from the post that it works for you, Ike. [link to post] Me next!

    – Posted using Chat Catcher