InterSet Ltd

How to Disable Plugin Deactivation for Any Specific Plugins

Warning: Trying to access array offset on value of type bool in /var/www/vhosts/ on line 38
interset snippets

Share Now:

Share on facebook
Share on linkedin
Share on twitter
Share on email
0 0 votes
Article Rating

Are you looking for a way to remove the deactivate link from specific plugins? There may be any plugin for this but we have created a quick simple code snippet that will help you to prevent plugin deactivation for any specific plugin in WordPress.

This will help you stop users from deactivating core plugins while still providing access. Also it can be used in WordPress multi-site also.


All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

add_filter( 'plugin_action_links', 'slt_lock_plugins', 10, 4 );
function slt_lock_plugins( $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;

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy/paste code snippets in WordPress, so you don’t accidentally break your site.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments

Get Free Access to InterSet’s 1 GB SSD Hosting with Website Design

Know Your

interset app coming soon

More You Would be interested in . . .

Have you any Question ?
Ask us !

Would love your thoughts, please comment.x