I wish to deactivate my plugin, but WITHOUT using update_option() or any other core WP function. What’s the best way to go about this? Direct DB connection and modification?
Leave a Reply
You must be logged in to post a comment.
I wish to deactivate my plugin, but WITHOUT using update_option() or any other core WP function. What’s the best way to go about this? Direct DB connection and modification?
You must be logged in to post a comment.
The simplest way is probably renaming the plugin file or folder.
But if you’re trying to handle it directly from the database, you’d have to grab the ‘active_plugins’ value from the wp_options table, unserialize it, remove your plugin from the array and reserialize it and update. You don’t necessarily have to use update_option.
You could also look into a command line tool like WP-CLI. With that installed, deactivating a plugin is a simple command from the BASH shell, like wp plugin deactivate plugin-name.
You could log into the UI and deactivate it there. Assuming you are looking for a programmatic solution, if you don’t want to use any WordPress functions, your only option would be to use a direct connection to query your db.
Without knowing the context in which you’re attempting to do this, it’s hard to provide a lot of help. But you can deactivate a plugin via FTP by renaming the plugin’s directory. WordPress will automatically deactivate it the next time it tries to load.