Ensure that plugin(s) reamins active

I overlook about 40 sites. I want to set up an alert if someone turns off important plugins like WordFence. Is such a thing possible?

Hi @socquestions,

Here is something you can use to make sure that noone can disable the plugin:

add_filter( 'plugin_action_links', 'disable_plugin_deactivation', 10, 4 );
function disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) {
    if ( array_key_exists( 'deactivate', $actions ) && in_array( $plugin_file, array(
        'wordfence/wordfence.php'
    ) ) )
    unset( $actions['deactivate'] );
    return $actions;
}

This will simply remove the Deactivate action for the plugin on the Plugins > Installed Plugins page.

You can use the MainWP Code Snippets Extension to apply this to all your child sites.

OK so using this plug-in is like running a must-use plug-in on each of the child sites? Thank you this gives me an option to explore.

It’s like you would add the code snippet in functions.php file in each child site.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.