Unset plugins on front-end belonging to specific category

I have a function which unset plugins on the front-end.

The only extra criteria, in_category ( 'my-cat-name' ), I am not able to achieve.

Where and how to add the category so the plugins are only unset on post types which belong to this category?

I tried if( !is_admin() is_category('my-cat-name') ) but that seems not correct.

Below the code I have add, in a separate file, in the mu-plugins folder.

As it is now, the plugins are removed from all post and that is not what I want to achieve.

if( !is_admin() ) {
    add_filter( 'option_active_plugins', 'de_active_plugins' );    
}
function de_active_plugins( $plugins ) 
{
    $skip   = array();   
    $skip[] = 'plugin01_foldername/plugin01_name.php';   
    $skip[] = 'plugin02_foldername/plugin02_name.php';   

    foreach ( $skip as $plugin ) {
        $collected = array_search( $plugin, $plugins );
        if( false !== $collected ) {
            unset( $plugins[$collected] );
        }
    }
    return $plugins; 
}

I appreciate all help.

Topic deactivation front-end categories plugins Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.