Last active
June 2, 2023 15:10
-
-
Save devuri/034ccb7c833f970192bb64317814da3b to your computer and use it in GitHub Desktop.
Prevent Admin users from deactivating plugins.
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 | |
/** | |
* Prevent Admin users from deactivating plugins. | |
* | |
* While this will remove the deactivation link it does NOT prevent deactivation | |
* It will only hide the link to deactivate. | |
*/ | |
add_filter( 'plugin_action_links', function ( $actions, $plugin_file, $plugin_data, $context ) { | |
if ( array_key_exists( 'deactivate', $actions ) ){ | |
unset( $actions['deactivate'] ); | |
} | |
return $actions; | |
}, 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment