How to Disable Plugin Deactivation from WordPress Admin Panel

Just add the following code in your functions.php 

add_filter( 'plugin_action_links', 'disable_plugin_deactivation', 10, 4 );
function disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) {
 // Remove edit link for all
 if ( array_key_exists( 'edit', $actions ) )
  unset( $actions['edit'] );
 // Remove deactivate link for crucial plugins
 if ( array_key_exists( 'deactivate', $actions ) && in_array( $plugin_file, array(
  unset( $actions['deactivate'] );
 return $actions;

Now, you need to change the array of $plugin_file where you see the list of specified plugins. The path of the file is relative to /wp-content/plugins/. So in the example above ‘facebook-open-graph-meta-in-wordpress/fbogmeta.php’ is a file located in the folder facebook-open-graph-meta-in-wordpress which is located inside the plugins folder. You can change the list to add as many plugins as you want.

Related Post

Latest Post

Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.