Disable plugin on Specific Page of Admin

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.

<?php
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.

Leave a Comment