Created
March 22, 2017 16:21
-
-
Save infoscigeek/1e1d194155d434c99b28485678a78f78 to your computer and use it in GitHub Desktop.
Disabling a plugin on certain pages using a MU plugin. Author: Kamil Grzegorczyk
This file contains 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 | |
/* | |
Plugin Name: Cart66 remover | |
Plugin URI: http://www.lowgravity.pl | |
Description: Removes cart66 plugin from pages which are not store pages | |
Author: Kamil Grzegorczyk | |
Version: 1.0 | |
Author URI: http://www.lowgravity.pl | |
*/ | |
add_filter( 'option_active_plugins', 'lg_disable_cart66_plugin' ); | |
function lg_disable_cart66_plugin($plugins){ | |
if(strpos($_SERVER['REQUEST_URI'], '/store/') === FALSE AND strpos($_SERVER['REQUEST_URI'], '/wp-admin/') === FALSE) { | |
$key = array_search( 'cart66/cart66.php' , $plugins ); | |
if ( false !== $key ) { | |
unset( $plugins[$key] ); | |
} | |
} | |
return $plugins; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment