Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JayHoltslander/54bafb8460718029087bc762f3ea7942 to your computer and use it in GitHub Desktop.
Save JayHoltslander/54bafb8460718029087bc762f3ea7942 to your computer and use it in GitHub Desktop.
Deactivate certain Wordpress plugins when running on the development/staging domain
<?php
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$plugins = array(
'wordpress-seo/wp-seo.php',
'broken-link-checker/broken-link-checker.php'
);
if ( strpos(get_site_url(), 'devserver.com') !== false ) {
deactivate_plugins( $plugins );
}
else {
activate_plugins( $plugins );
}
@vram1980
Copy link

Where would you put this? functions.php?

@JayHoltslander
Copy link
Author

Where would you put this? functions.php?

I use it as a plugin in the wp-content/mu-plugins folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment