Skip to content

Instantly share code, notes, and snippets.

@thisbit
Created January 20, 2022 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisbit/b6d081ccf83cf20f9b3f2ece4ac335e1 to your computer and use it in GitHub Desktop.
Save thisbit/b6d081ccf83cf20f9b3f2ece4ac335e1 to your computer and use it in GitHub Desktop.
<?php
// best put in theme that depends on certain plugins
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(
'advanced-custom-fields/acf.php',
'gp-premium/gp-premium.php'
)))
unset( $actions['deactivate'] );
return $actions;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment