Forked from JayHoltslander/deactivate-plugins-on-domain.php
Last active
May 23, 2022 20:21
-
-
Save katoen/71481e310e6089436cda0b93d1c0afdf to your computer and use it in GitHub Desktop.
Deactivate or activate certain Wordpress plugins when running on the development/staging domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
$plugins_staging = array( | |
'wp-reroute-email/wp-reroute-email.php' | |
); | |
$plugins_prod= array( | |
'google-site-kit/google-site-kit.php', | |
'lite-speed-cache/lite-speed-cache.php', | |
'microsoft-clarity/clarity.php' | |
); | |
if ( strpos(get_site_url(), 'devserver.com') !== false ) { | |
/*staging plugins*/ | |
deactivate_plugins( $plugins_prod); | |
activate_plugins( $plugins_staging ); | |
} | |
else { | |
/*prod plugins*/ | |
//activate_plugins( $plugins_prod); | |
deactivate_plugins( $plugins_staging ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment