Recently, while working on a client project, I had to test and use a plugin on a site. I installed the plugin from the site’s dashboard, activated it, and…… *Boom*. The site just crashed! I was left staring at the White Screen of Death.
I knew I had to deactivate the plugin. Things were worse, because I did not have FTP access to the site. But every problem poses an opportunity to innovate. I had access to phpmyadmin. Using phpmyadmin, I was able to deactivate the plugin, and I got the site back on track.
In case, you are ever stuck in my situation, this is what you would have to do.
Important: Since you would have to make changes in your database, you need to backup your database, just in case something goes wrong. You can use the backup to revert the changes.
Let’s take an example…
Just as an example, we will consider a site which has two plugins activated ‘Akismet’ and ‘Hello Dolly’. And we will try to deactivate ‘Akismet’ plugin using phpmyadmin.
Find the List of Active Plugins in the Database
First, login to phpmyadmin and navigate to the database of your site. Select wp_options table (‘wp’ is the database prefix. If you had a different prefix, the table name would be <your_database_prefix>_options)
Search for the option ‘active_plugins’. The option_name will be ‘active_plugins’, and the value, option_value, will contain the list of all activate plugins in a serialized format.
Remove Plugin to be Deactivated from Active Plugins List
To deactivate ‘Askimet’ plugin, we would need to remove it from this list. To edit this list, we would have to deserialize it, so that it is readable, remove the said plugin, and serialize it again, to set the option_value, for active_plugins.
Click ‘Edit’, and copy the option_value data and deserialize it. You could use a site like http://www.unserialize.me/, for data deserialization. If you use unserialize.me, then make sure you choose, ‘Unserialized var_export’, as the output format. You should see the output in the form of an array.
Example: array ( 0 => ‘akismet/akismet.php’, 1 => ‘hello.php’, )
Since we want to deactivate ‘Akismet’ plugin, we have to remove the corresponding key-value pair from the array. Hence, we have to remove the line 0 => ‘akismet/akismet.php’ .
Our array will then be,
array ( 0 => ‘hello.php’, )
Important: After removing required key-value pair make sure you re-index the remaining plugins properly. The array should always start with key ‘0’. If you remove a plugin from in-between, make sure you change the key values for the rest of plugins.
Update List of Active Plugins
To set this new array for activated plugins, we need to serialize it. You can use a site like http://php.fnlist.com/php/serialize for this purpose.
Copy the serialized output, and replace the value of ‘option_value’ field with this new value. Click ‘Go’, to ensure that your changes take effect.
And it’s Done!
If you go back to your site’s dashboard, you should now see ‘Askimet’ plugin deactivated, while ‘Hello Dolly’, will still be active. Rest assured, this will work, and in case some problem occurs you can revert back to your backed up database.