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!

  • which plugin is it exactly ? Also, by "page", you mean a Page or a Post ? – mike23 Jun 28 '11 at 7:49
  • Does this plugin use a shortcode? – MartinJJ Jun 28 '11 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 – Rev. Voodoo Jun 28 '11 at 13:25
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 :)

| improve this answer | |
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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