How To Disable A Plugin For Specific Pages And Posts

Occasionally, we come across a challenging scenario where two plugins are at odds with each other. To properly address the conflict, a significant amount of effort would be required, but in the meantime you probably need a quick fix.

If the conflict is noticeable on a particular webpage or post, it may be worth considering deactivating the plugin only on that specific page or post. However then the question becomes how can you easily accomplish this?

Disabling A Plugin For Specific Pages And Posts

There is a cool code snippet I use to achieve this and it works perfectly. It is a quick and dirty fix, but it will get the job done.

You should create Must Use plugin and add this code:

add_filter( ‘option_active_plugins’, ‘disable_specific_plugin’ );
 function disable_specific_plugin($plugins){
      if( $_SERVER[‘REQUEST_URI’] == ‘/people/’ ) {
         $key = array_search( ‘name_of_plugin_folder/plugin_core.php’ , $plugins );
         if ( false !== $key ) unset( $plugins[$key] );
     return $plugins;

In this example, I am looking for people slug on the website. You can use something different under the if statement as well, like is_page() or is_single() to target a specific page or post you need.

It would be something like this: if ( is_page($your_page_id) )…

Be sure to try this on the staging site first and if it works, just do the same on the live site and you will be good to go.

I hope that you find this helpful. Do you have questions or want to talk more about this? Contact us!