1

How would I disable a plugin on one page?

For example, I have a plugin for Social Icons that appears on all pages, but I would like it NOT to show up on one page.

Thanks!

4
  • which plugin is it exactly ? Also, by "page", you mean a Page or a Post ?
    – mike23
    Commented Jun 28, 2011 at 7:49
  • Does this plugin use a shortcode?
    – MartinJJ
    Commented Jun 28, 2011 at 7:50
  • as a general strategy if you wish to try.... I tend to read through the code to find the specific function that outputs whatever the plugin does. Often times if you can find that function you can write a conditional into yur template (or header or functions.php) which says to not do the function on certain pages Commented Jun 28, 2011 at 13:25
  • wordpress.stackexchange.com/users/3429/rev-voodoo i like it. Commented Aug 10, 2011 at 9:35

2 Answers 2

1

Yes, you can disable specific plugins or scripts form appearing in certain pages.

Here's an example how I disabled the easy fancybox plugin from appearing

Hope it helps :)

0

to completely disable it you could write a mu-plugin. If you don't have it, create a folder called mu-plugins inside the folder wp-content and create a php file where you can try this code:

if( !is_admin() && empty( $_POST ) ){
$uri = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$uriArr = explode( '?',$uri );
$uri = $uriArr[0];
if( $uri === '[url_page]' ){
    $paths = array(
        'plugin_folder1/plugin1.php'
        'plugin_folder2/plugin2.php'
    );
    global $paths;
    add_filter( 'option_active_plugins', 'my_option_active_plugins' );      
} }


function my_option_active_plugins( $plugins ){
global $paths;  
foreach( $paths as $path ){
    $k = array_search( $path, $plugins );
    if( false !== $k ){
        unset( $plugins[$k] );
    }
}
return $plugins;
}

Just replace 'plugin_folder1/plugin1.php' ... with the plugin you want to deactivate, if it's only the social plugin you can delete the row 'plugin_folder2/plugin2.php', if you have other plugins you can add them. Replace [url_page] with the URL of the page where you don't want the plugins.

Another option is to install the free plugin Freesoul Deactivate Plugins, and then you can deactivate all the plugins you want on every page, post, custom post and archive where they are not used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.