Disabling a WordPress Plugin Without Access to wp-admin

I had an SSL plugin enabled making local access without SSL problematic. My glorious hack around this (only tested in bash):

mysql -N -B {db_name} -e "SELECT option_value FROM wp_options WHERE option_name = 'active_plugins';" | php -R '$a = unserialize($argn); $a = array_values(array_diff($a, ["{plugin_to_remove}"])); print("UPDATE wp_options SET option_value = '"'"'" . serialize($a)) . "'"'"' WHERE option_name = '"'"'active_plugins'"'"';\n";' | mysql -vv {db_name}

Replace {db_name} with the database name and {plugin_to_remove} with the plugin string, something like “really-simple-ssl/rlrsssl-really-simple-ssl.php”. You may need -u and -p options in the two mysql commands. In my local setup I lazily auto-login as mysql root.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.