Skip to content

Instantly share code, notes, and snippets.

@gregrickaby
Forked from JPry/Disable Plugins.md
Last active September 14, 2020 09:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregrickaby/55b4b38d47e8fe5577d8 to your computer and use it in GitHub Desktop.
Save gregrickaby/55b4b38d47e8fe5577d8 to your computer and use it in GitHub Desktop.

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/JCPry/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