Replace the /your-page-slug/
with your desired page where you want to disable the plugin and plugin-folder/plugin-main-file.php
is plugin directory and plugin main file name with .php
extension.
add_filter( 'option_active_plugins', 'the_dramatist_disable_plugin_on_certain_page' );
function the_dramatist_disable_plugin_on_certain_page($plugins){
if(strpos($_SERVER['REQUEST_URI'], '/your-page-slug/') === FALSE && strpos($_SERVER['REQUEST_URI'], '/wp-admin/') === FALSE) {
$key = array_search( 'plugin-folder/plugin-main-file.php' , $plugins );
if ( false !== $key ) unset( $plugins[$key] );
}
return $plugins;
}
Hope this piece of code help you.