Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Disable Plugins

Quickly disable all plugins in WordPress.

Usage

This plugin needs to go into the wp-content/mu-plugins/ directory. Provided you have SSH access to the server where WordPress lives, you can do this:

cd $SITE_ROOT/wp-content/mu-plugins
curl -LO 'https://gist.githubusercontent.com/JPry/8026015/raw/disable-plugins.php'

If you only have S/FTP access to the server, then you will need to first download the files. Once you have download the zip file, unzip it and upload just the disable-plugins.php file to your wp-content/mu-plugins/ directory of your site.

Once you are done with this file, simply remove it and all of your plugins will be reactivated.

<?php
/**
* Plugin Name: Disable All Plugins
* Plugin URI: https://gist.github.com/JPry/8026015
* Description: Short-circuits the function in WordPress that determines which plugins are activated, and tells WordPress that no plugins are activated
* Version: 1.0
* Author: Jeremy Pry
* Author URI: http://jeremypry.com/
*/
add_filter( 'pre_option_active_plugins', '__return_empty_array' );
add_filter( 'pre_site_option_active_sitewide_plugins', '__return_empty_array' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.