开发者

How to "deactivate" plugin if error in wordpress?

开发者 https://www.devze.com 2023-04-13 02:50 出处:网络
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 act

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号