Skip to content

Instantly share code, notes, and snippets.

@andrezrv
Last active August 29, 2015 14:00
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 andrezrv/11131581 to your computer and use it in GitHub Desktop.
Save andrezrv/11131581 to your computer and use it in GitHub Desktop.
Activate plugins by checking the IP address of the server where our site is running.
<?php
add_filter( 'option_active_plugins', 'activate_local_plugins' );
/**
* Add our local plugins to the list of active plugins.
*/
function activate_local_plugins( $plugins ) {
if ( '127.0.0.1' == $_SERVER['SERVER_ADDR'] ) {
$local_plugins = array(
'wordpress-beta-tester/wp-beta-tester.php',
'wordpress-importer/wordpress-importer.php',
);
foreach ( $local_plugins as $plugin ) {
$plugins[] = $plugin;
}
}
return $plugins;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment