Last active
July 16, 2019 12:01
-
-
Save anibalardid/5f20826b2edb81c832fddbe4f31f23f6 to your computer and use it in GitHub Desktop.
[carga condicional plugins wp] codigo mio viejo #WordPress #Plugins
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 | |
// My post: https://es.wordpress.org/support/topic/tutorial-como-deshabilitar-algunos-plugins-de-algunas-paginas-especificas/ | |
/* | |
Plugin Name: Plugin Selector | |
Plugin URI: https://ardid.com.ar | |
Description: Removes plugins in selected pages | |
Author: Anibal Ardid | |
Version: 1.0 | |
Author URI: https://ardid.com.ar | |
*/ | |
if (!is_admin()) { | |
add_filter( 'option_active_plugins', 'plugin_selector' ); | |
function plugin_selector($plugins){ | |
if(strpos($_SERVER['REQUEST_URI'], '/search/') === 0) { | |
// KK Star Ratings | |
$key = array_search( 'kk-star-ratings/index.php', $plugins ); | |
if ( false !== $key ) { unset( $plugins[$key] ); } | |
// Shareaholic | |
$key = array_search( 'shareaholic/shareaholic.php', $plugins ); | |
if ( false !== $key ) { unset( $plugins[$key] ); } | |
// Genesis Responsive Slider | |
$key = array_search( 'genesis-responsive-slider/genesis-responsive-slider.php', $plugins ); | |
if ( false !== $key ) { unset( $plugins[$key] ); } | |
// Contextual Related Posts | |
$key = array_search( 'contextual-related-posts/contextual-related-posts.php', $plugins ); | |
if ( false !== $key ) { unset( $plugins[$key] ); } | |
} elseif($_SERVER['REQUEST_URI'] === '/' || $_SERVER['REQUEST_URI'] === '') { | |
// KK Star Ratings | |
$key = array_search( 'kk-star-ratings/index.php', $plugins ); | |
if ( false !== $key ) { unset( $plugins[$key] ); } | |
// Shareaholic | |
$key = array_search( 'shareaholic/shareaholic.php', $plugins ); | |
if ( false !== $key ) { unset( $plugins[$key] ); } | |
} | |
return $plugins; | |
} | |
} |
Thanks, its work good.
your welcome ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, its work good.