WordPress 2.0 Fix
Published Monday, December 26th, 2005 at 9:24 pm
Ok, so after my last post on my WordPress 2.0 upgrade issues I started hacking around and discovered a fix but not exactly what it is on my setup that causes this problem while others are ok. If you are experencing this problem modify the wp-admin/plugins.php file to include an exit; after the header("Location: XXX"); commands. Just replace the first 25 lines of code with this:
<?php
require_once('admin.php');
if ( isset($_GET['action']) ) {
check_admin_referer();
if ('activate' == $_GET['action']) {
$current = get_settings('active_plugins');
if (!in_array($_GET['plugin'], $current)) {
$current[] = trim( $_GET['plugin'] );
sort($current);
update_option('active_plugins', $current);
include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] ));
do_action('activate_' . trim( $_GET['plugin'] ));
}
header('Location: plugins.php?activate=true');
} else if ('deactivate' == $_GET['action']) {
$current = get_settings('active_plugins');
array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
update_option('active_plugins', $current);
do_action('deactivate_' . trim( $_GET['plugin'] ));
header('Location: plugins.php?deactivate=true');
}
exit; // This is the fix
}
* Edit *
This fix has been included in WordPress 2.0.1.






December 27th, 2005 at 2:10 pm
Fix for the wordpress plugins problem people have been having
http://blog.hypercubed.com/index.php/archives/2005/12/26/wordpress-20-fix/
Adding the exit fixes something don’t know what it does as i’m not a php guru at all
…
December 27th, 2005 at 2:30 pm
When the php code calls header(‘Location: plugins.php?activate=true’); it is telling php to stop executing the page and go to the plugins.php?activate=true page. For some reason on some sites setup (mine is Windows NT with PHP Version 4.3.11) the execution does not stop and some code further down the page prevents the plugin from activating.
December 29th, 2005 at 6:08 pm
This is exactly what I’m searching about! Thanks and Happy New Year :)!
December 29th, 2005 at 8:18 pm
I was hoping that it would save some headache for others.
I should mention that this turned out to be a bug reported in Nov but because it is not reproducible (still don’t know why it happens) it was closed as a anomaly of the reporters system. Thanks to my reopening the bug it is now fixed in the WordPress trunk and will not be an issue in future releases. Feels good to give back to a program I appreciate so much.
January 3rd, 2006 at 7:27 pm
Thanks so much for this! It was exactly what I needed to get my upgrade working!!! Strong work!!
January 4th, 2006 at 6:11 pm
I forgot to deactive my plugins before upgrade to wp2.0 so now plugins are not working. Like you said, the message says plugin activated but not working at all. But for you is you did deactive all your plugins before the upgrade rite? I really missed that part and now i’m in trouble.
What about I deactive the plugins and run the upgrade.php file again? will that work or try ur code above will solve my plugin issue…I just dont want to mess up again. So i’m making sure your code will not cause anymore damage.
Please don’t take me wrong, seems like others working fine with your code. Should I deactive plugins before I do changes to plugins.php page?
Appreciate ur help. Thanks.
January 4th, 2006 at 6:17 pm
I don’t think you need to worry about implementing this code. All I’m doing is making the code work the way it was intended. I suspect that on most systems the exit command is not needed because the header commands effectively do the same thing by directing the server to another page. Give it a try. I don’t think it could cause any harm.
January 4th, 2006 at 6:55 pm
Hey it’s working!!!! THANK YOU SOOOO MUCH! :D
Your one line does really make an effect. Thanks again.
Regards,
May
January 7th, 2006 at 12:15 pm
Just started the upgrade process – first issue found and now fixed. Many thanks.
January 11th, 2006 at 9:56 am
thanks for this post, it worked perfectly
January 17th, 2006 at 9:52 am
you’re my hero!
January 20th, 2006 at 8:45 pm
Thanks, Dude! Very much appreciated.
January 28th, 2006 at 12:21 am
You can now also download a copy of plugins.php from the wordpress source website which already has the patch applied:
http://trac.wordpress.org/file/trunk/wp-admin/plugins.php?rev=3365&format=raw
March 26th, 2006 at 1:00 am
[...] My favorite are the hacks, fixes and tips. The posts are where something wasn’t working or wasn’t working the way I wanted so I fixed it. I’ve always been doing these type of things but finally I found a medium to share my experences. I feel quite satisfied being able to share these with others. These also end up being my most popular posts. Some examples are a fix for a WordPress 2.0 bug that prevented WP from running on windows machines (fixed in WP 2.0.1 version thanks to my bug report). I shared my method for hiding the WordPress post preview. I fixing a problem debugging Visual Studio applications with .NET 2.0 runtime installed. I also used my blog to spread the word of my first Firefox extension. [...]