Disable WordPress Plugins in the Database

Whilst many WordPress plugins work seamlessly with your website when installing them, there may be a few that aren’t compatible with your website or perhaps aren’t built well or break when WordPress is upgraded. Often problematic plugins can be disabled from within the WordPress admin, however there may be times where the troublesome plugin has locked you out of the admin leaving you feeling helpless. Fortunately, you can disable WordPress plugins in the database and restore normal site functionality.

To disable plugins using this method, take a look at the wp_options database table. Look at the records within the option_name column, and you should see an active_plugins name. You should also notice that the option_value value for this row contains a serialised array that might look something like the below.


The string will be larger for those who have previously installed WordPress plugins.

If you wanted to disable all of the plugins, you could simply delete this data within option_value. This sounds like a big change, but you should be able to regain access to your WordPress admin and enable the plugins of your choice.

However, there might be times where you only want to disable specific plugins in order to troubleshoot issues.

Examine the array, you’ll be able to break out the string into individual parts.

  • a:2: – The number 2 represents the current number of active plugins.
  • i:0;s:19:"akismet/akismet.php";i:0; is simply an index number. With arrays, this number starts from zero. s:19:"akismet/akismet.php"; represents a string of 19 characters, which is the number of characters contained within the ‘akismet/akismet.php’ plugin file string.
  • i:1;s:9:"hello.php";i:1; represents the second element in the array, and s:9:"hello.php"; represents a string of 9 characters, which is the number of characters contained within the ‘hello.php’ plugin file string.

If for example, you needed to disable the Askimet plugin, you would first remove the i:0;s:19:"akismet/akismet.php"; line, the i:1;s:9:"hello.php"; line would now become i:0;s:9:"hello.php"; as this is now the first element in the array.

Finally, a:2: would become a:1:, as now there is only one active plugin in the array.

By following these steps when disabling a specific plugin in your database, you should be able to troubleshoot any plugin-related issues on your website and apply a fix accordingly.

Note: This article is based on WordPress version 4.9.