Skip to content

Instantly share code, notes, and snippets.

@heyfletch
Last active July 19, 2019 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save heyfletch/07a3677f69f94a02aaa02621075e5d6e to your computer and use it in GitHub Desktop.
Save heyfletch/07a3677f69f94a02aaa02621075e5d6e to your computer and use it in GitHub Desktop.
Actually, I created a plugin here: https://github.com/heyfletch/fd-disable-local-plugins
<?php
/*
Plugin Name: Deactivate Plugins in Development
Plugin URI: https://gist.github.com/heyfletch/07a3677f69f94a02aaa02621075e5d6e
Description: Create a list of plugins to deactivate on local development. Doesn't effect production plugins.
Author: Fletcher Digital
Version: 0.1
Author URI: https://fletcherdigital.com
*/
/* Disable specified plugins in development environment */
if (defined('WP_ENV') && WP_ENV == 'development') {
$plugins = array(
'autoptimize/autoptimize.php',
'cloudflare/cloudflare.php',
'google-analytics-for-wordpress/googleanalytics.php',
'limit-login-attempts-reloaded/limit-login-attempts-reloaded.php',
);
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
deactivate_plugins($plugins);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment