Removed plugin generating error message

I kinda did something stupid. To test something I created a couple of plugins and during testing I think I renamed the plugin. Now I deleted the plugins but I'm still getting an error message saying the plugin couldn't be found:

The plugin something else has been deactivated due to an error: Plugin file does not exist.

I searched the database and there's an activate_plugins entry in wp_options. It contains the following:

a:4:{i:0;s:23:"bandpress/bootstrap.php";i:3;s:56:"posts-from-single-category-widget/post_from_category.php";i:4;s:15:"something else ";i:5;s:68:"syntax-highlighter-with-add-button-in-editor/syntaxhighlighterpp.php";}

So, I think I need to remove the "something else " part of this field, but I don't know which parts I should (or shouldn't) remove. What part do I need to remove to get rid of the error message, without affecting the other plugins?

Topic deactivated-plugin errors Wordpress

Category Web


The approach in the answer by Scuba Kay is technically possible but easy to get wrong. Small mistakes will cause the data to fail to unserialize correctly. You are better off "editing" the serialized data with PHP:

$str = 'a:4:{i:0;s:23:"bandpress/bootstrap.php";i:3;s:56:"posts-from-single-category-widget/post_from_category.php";i:4;s:15:"something else ";i:5;s:68:"syntax-highlighter-with-add-button-in-editor/syntaxhighlighterpp.php";}'; // copies from database
$strar = unserialize($str);
var_dump($strar); // find the key in the var_dump
unset($strar[4]); // remove the key you need to remove
echo serialize($strar); // copy and paste this back into the database

It is possible to do the same thing a bit more "automated" by using get_option and update_option.

But there are other ways to remove a stubborn plugin. The first that comes to mind, and simplest, is to use (s)FTP to just physically delete (or rename) the plugin file/folder from the wp-content/plugins directory.


So I fixed my problem. Here's how:

a:4:{
    i:0;s:23:"bandpress/bootstrap.php";
    i:3;s:56:"posts-from-single-category-widget/post_from_category.php";
    i:4;s:15:"something else ";
    i:5;s:68:"syntax-highlighter-with-add-button-in-editor/syntaxhighlighterpp.php";
}

I figured out every activated plugin is defined between the i and the ;, so by removing the following my error message dissapeared:

i:4;s:15:"something else ";

[edit]

I should also have changed a:4 to a:3. I didn't and I ended up with a:0 { }. However, after reactivating my plugins I was back to the way it was.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.