Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress deactivate a plugin via database?

Tags:

php

wordpress

I have a wordpress script, wp-supercache, that I need to disable (as its cached on a nasty error), however, the error is causing the wp-admin redirect to fail, which means I can't get into the site to disable the plugin.

Any advice? I can access the database via cpanel.

like image 813
Scott B Avatar asked Apr 12 '10 18:04

Scott B


People also ask

How do I disable plugins in WordPress database?

Normally, disabling a WordPress plugin is very simple and straightforward. How easy? You can login to your admin area, click the “Plugins” tab and click “Deactivate” next to the plugin.

How do I disable WordPress plugins without admin access?

Once you've accessed the root folder of WordPress, find and access the directory labeled, “wp-content.” Find the directory labeled, “plugins.” Right-click this folder and then click the “Rename” option near the bottom of the list. Rename the folder, “plugins. deactivate.”


2 Answers

Try re-naming the folder of the plugin and then see if error is gone (make backup first of course.). If that does not help, here is the solution then.

like image 163
Sarfraz Avatar answered Oct 07 '22 10:10

Sarfraz


To disable a specific plugin, you have to remove it from the serialized string that stores the list of all plugins - that's set in the option_value column of the wp_options table as discussed by @TimDurden. The specific format change you have to make is, taken shamelessly from teh Internet:

a:4:{
    i:0;s:19:"akismet/akismet.php";
    i:1;s:36:"google-sitemap-generator/sitemap.php";
    i:2;s:55:"google-syntax-highlighter/google_syntax_highlighter.php";
    i:3;s:29:"wp-swfobject/wp-swfobject.php";
}

That first set of characters - a:4 - designates an array and its length. Note also that each line in the list of plugins has an index. So:

  1. Decrement the index (from 4 to 3 in this case)
  2. In each line, decrement the number after the i:
  3. Remove the specific plugin you want to disable.

Update the value in the db using the new string you constructed from these steps:

update wp_options set option_value=<new value> where option_id=<id of this option>

Note that your table name might not be wp_options - you might have a prefix to add.

like image 22
sameers Avatar answered Oct 07 '22 10:10

sameers