Turn on / off WP plugins via url hook

WP plugin switch

1

2

3

4

5

6

7

8

9

10

11

12

functionplugin_switch($pluginname){

// If these are set then let it do it's job!!!

if($_GET['optimize']=='activate'){// Only activate it if plugin isn't active if (!is_plugin_active('/autoptimize/autoptimize.php') ) { activate_plugins('/autoptimize/autoptimize.php', true); } } // If these are set then let it do it's job!!! if ($_GET['optimize'] == 'deactivate') { // Only activate it if plugin isn't active if (is_plugin_active('/autoptimize/autoptimize.php') ) { dactivate_plugins('/autoptimize/autoptimize.php', true); } }