I have 2 plugins

1) FAT Gallery

2) Salon Booking

So FAT Gallery has a certain js lib (select2) which conflicts with Salon Booking Settings page.

In this URL


I'm trying to DISABLE the FAT Gallery because it causes js error and i cant do my job.

Any idea of how to block it ONLY on the certain page?

Thanks a lot!

3 Answers 3


That's pretty easy.

Remember, I don't know exactly what's the plugin's file name and directory, and the following code was not tested.

Put this to the functions.php or create a small plugin.

add_filter( 'option_active_plugins', 'wpse264498_deactivate_fat_gallery' );

function wpse264498_deactivate_fat_gallery($plugins){

    // check if you are on the certain page
    global $pagenow;
    if( $pagenow == 'post-new.php' ) {

        // check if it's right CPT
        if( isset($_GET['post_type']) && $_GET['post_type'] == 'sln_booking') {

            // search the plugin to disable among active plugins
            // Warning! Check the plugin directory and name
            $key = array_search( 'fat-gallery/fat-gallery.php' , $plugins );

            // if found, unset it from the active plugins array
            if ( false !== $key ) {
                unset( $plugins[$key] );

    return $plugins;

Also, you can try Plugin Organizer.

  • Thanks for the answer! in your example, what should i check to be compatible? only $key = array_search( 'fat-gallery/fat-gallery.php' , $plugins ); ? Commented Apr 22, 2017 at 20:14
  • it's working :D Commented Apr 22, 2017 at 20:21

I have tested Plugin Organizer but I found it difficult to use.

In replacement I found Freesoul Deactivate Plugins which have a really nice and simple UI and works perfectly well.


Try something like this. This does not deactivate the whole plugin but just remove the script that causes problems. Not tested, look the functions up if you don´t know how to use them and what parameters to use.

// add this hook if in admin area
if (is_admin()) add_action("wp_enqueue_scripts", "my_dequeue_script", 99);
function my_jquery_enqueue() {
   // don´t do it if it´s not the page you want to remove the script
   if (get_current_screen() != "yourpage") return;
   // deregister the script
   // find the exact name of the script in the plugin where it is registered


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.