How to disable WordPress plugin directly from DB

Several days ago I’ve experienced an unpleasant situation where I was locked out of my WordPress admin page due to a bug / misconfiguration in Google Captcha (reCAPTCHA) by BestWebSof. Each time I tried to login I was denied, regardless of the captcha being marked:

how to disable wordpress plugin


Pretty nasty situation, considering that I’m locked out of the admin panel, where all plugin-related operation are performed. After a little research I realized that it can be done directly from WP mySQL DB, as long as you have access to it. Luckily, I was running WP on EC2 instance in my AWS so I had full privileges to access mySQL DB.

How to disable WordPress Plugin manually

The following procedure was performed to temporary disable BestWebSof Google Captcha plugin. Bear in mind that it is eligible for all other plugins preventing access to the admin panel or alternatively, cannot be disabled via the admin panel.

  1. Connect to the DB hosting WordPress – Usually mySQL DB. You can use whatever GUI to access to your database back end (MySQL). For my case, I used mySQL CLI directly from my web hosting server. The plugin configuration is stored in a table called wp_options.
  2. Now, lets look for active plugins with the following sql statement:
    SELECT option_name FROM `wp_options` WHERE option_name = 'active_plugins'
  3. The result should be in the following form:

    Where represent the number of active plugins and each the id of the plugin. As you see, I have had 12 plugin enables in system. But what I would like to do now is to disable google-captcha. To do so, I need to change the value a:12: to a:11:. Means that only 11 plugin will be enabled. Then remove


    Hence, this whole string should be deleted, all other consecutive i indexes should be updated respectively.

  4. Please backup your database and/or your files/folders before making any change. This can solve to restore back the website in case of any problem happen unexpected.
  5. This is the final UPDATE query that was used:
    UPDATE wp_options 
    SET option_value="a:11:{i:0;s:59:\"black-studio-tinymce-widget/black-studio-tinymce-widget.php\";
    WHERE option_name = 'active_plugins';

Once the query is submitted, you’ll be able to log in to the admin console without reCAPTCHA validation. Now that you have access to the console, you can go to the plugin section and delete / edit the faulty plugin.

Leave a Comment