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!
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!
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 :)
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.