Wordpress: Warning: Could not activate the plugin.

--

Very recently I was performing some Wordpress Plugin development when I experienced a very strange error when attempting to install and activate my development plugin:

Warning: Could not activate the '<your plugin name>' plugin.

What made the error so strange is that nothing appeared in the logs anywhere to suggest what the root cause of the error might be.

After much deliberating, I eventually used wp db search <your plugin name> and discovered that the active_plugins wp_option still had my NOT active development plugin in the list. So how best to refresh active_plugins so that it started showing the correct value?

I solved the problem by picking a different plugin altogether and deactivating / reactivating it. That cleared out the active_plugins back to the right value after which I was able to successfully install my plugin.

I hope this helps somebody else.

--

--