I am running SQL commands and when there is an error I want to deactivate my plugin. Do I开发者_如何学Go do that with wp_die
or is there some other preferred method?
My understanding is that plugin activation/deactivation is controlled by the wp_options table in the DB.
You might consider a second MySQL call that deactivates the specific plugin. You can get all active plugins using this:
SELECT * FROM wp_options WHERE option_name = 'active_plugins';
You can update the list with something like this:
UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins';
Obviously, you'd want to modify this to target the specific plugin.
I saw this method used here, in which the author is describing how to deactivate ALL plugins via a MySQL query. Hope this helps.
精彩评论