Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Created August 20, 2015 17:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save wpscholar/c5e7f83c0350b4246623 to your computer and use it in GitHub Desktop.
Save wpscholar/c5e7f83c0350b4246623 to your computer and use it in GitHub Desktop.
<?php
/**
* Drop this code into your main plugin file to hide plugin deactivation from the WordPress admin.
*/
add_filter( 'plugin_action_links', function ( $actions, $plugin_file ) {
if ( plugin_basename( __FILE__ ) === $plugin_file ) {
unset( $actions['deactivate'] );
}
return $actions;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment