Created
July 30, 2021 02:00
-
-
Save the-sufi/8a7b709d144392c7397a29f985fd9428 to your computer and use it in GitHub Desktop.
WordPress - Disable option to deactivate Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable option to deactivate Plugin | |
* | |
* @param $actions | |
* @param $plugin_file | |
* @param $plugin_data | |
* @param $context | |
* @return mixed | |
*/ | |
function dctit_disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) { | |
$plugins = array( | |
'advanced-custom-fields-pro/acf.php',//update/add/delete as needed | |
); | |
if ( array_key_exists( 'deactivate', $actions ) && in_array( $plugin_file, $plugins) ) { | |
unset( $actions['deactivate'] ); | |
} | |
return $actions; | |
} | |
add_filter( 'plugin_action_links', 'dctit_disable_plugin_deactivation', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment