WordPress Plugin List Corruption
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);
}
...




swhitley (Shannon Whitley) said,
Wrote on March 24, 2009 @ 10:48 pm
Twitter Comment
@ikepigott @jangles – Here’s the fix for the WordPress Plugin List Corruption – [link to post]
– Posted using Chat Catcher
Ike Pigott said,
Wrote on March 24, 2009 @ 11:08 pm
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!
swhitley said,
Wrote on March 24, 2009 @ 11:13 pm
Thanks, Ike. I added some additional comments. Hope that will help others.
jangles (Neville Hobson) said,
Wrote on March 25, 2009 @ 12:40 am
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
Neville Hobson said,
Wrote on March 25, 2009 @ 3:21 am
And it works! Thanks Shannon.
(Btw, 1st try with your Twitter Connect plugin. Nice.)
Zashkaser said,
Wrote on August 5, 2009 @ 9:46 am
Very Interesting post! Thank you for such interesting resource!PS: Sorry for my bad english, I’v just started to learn this language