WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» How to Prevent Clients from Deactivating WordPress Plugins

How to Prevent Clients from Deactivating WordPress Plugins

Last updated on November 26th, 2019 by Editorial Staff
94 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Prevent Clients from Deactivating WordPress Plugins

Do you want to prevent clients from accidentally deactivating WordPress plugins on the website?

If you make websites for clients, then you probably already have a favorite toolkit of must-have WordPress plugins to install on each site. You may also add custom code snippets inside site-specific plugins for that client.

However, clients can accidentally deactivate one of those plugins, which may affect their site’s functionality or even break it completely.

In this article, we’ll show you how to safely prevent clients from deactivating WordPress plugins without restricting their control on the website.

How to stop clients from deactivating crucial plugins in WordPress

We will cover two methods, and you can choose the one that works best for you. We’ll also discuss some alternative approaches along the way.

Let’s start with the easiest option.

Method 1. Prevent Plugin Deactivation in WordPress by Using a Plugin

This method is easier and less intrusive. It also gives all users with administrator role full control, and they can turn it off whenever they want.

Basically, we will be using a plugin that will remove the ‘Deactivate’ link from all plugins. Users would still be able to install new plugins and can disable this prevention anytime at their own risk.

The first thing you need to do is install and activate the Disable Plugin Deactivation plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Plugins » Plugin Deactivation Settings page to configure plugin options.

Disable Plugin Deactivation settings

Simply select ‘Enable’ next to ‘Disable Plugin Deactivation’ option to turn off the ‘Deactivate’ link for all plugins.

Optionally, you can also disable plugin activation which will stop users from activating any other plugin. You can also turn off plugin deletion and prevent users from installing plugin updates.

Note: You should never disable plugin updates on client sites. This would compromise WordPress security and make your client vulnerable to security threats.

Don’t forget to click on the ‘Save changes’ button to store your settings.

You can now visit the plugins page to see the plugin in action. You’ll not see the ‘Deactivate’ link below any of the active plugins on the website.

No deactivation

The plugin provides an easier and non-obtrusive way to disable the plugin deactivation option. However, your clients can simply go to Plugins » Plugin Deactivation Settings page and disable this feature.

Method 2. Prevent Specific Plugins from Deactivation

This method allows you to prevent deactivation of a single plugin or a group of specific plugins installed on a website.

You’ll need to add code to your WordPress website. If you have not done this before, then take a look at our guide on how to easily add code snippets in WordPress.

First, you need to find the plugin locations that you want to disable. WordPress plugins are stored in the wp-content folder on your website.

You can view this folder by connecting to your WordPress hosting account using an FTP client. Inside the plugins folder, you’ll see different folders for each plugin installed on that website.

Plugins folder

Inside each folder, you’ll also find a plugin file, which is usually named after the plugin and ends with .php extension.

Next, you need to add the following code to your theme’s functions.php file or a site-specific plugin.

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(
		'wpforms/wpforms.php',
		'woocommerce/woocommerce.php'
	)))
		unset( $actions['deactivate'] );
	return $actions;
}

As you can see in the above code, we have disabled deactivation for two plugins, WPForms and WooCommerce.

We have added the plugins by mentioning their location inside the plugins folder. For example, wpforms/wpforms.php

Don’ forget to replace plugin locations with the plugins that you want to protect.

You can now visit the plugins page, and you will notice the deactivate link disappear below those plugins.

Specific plugins protected

This method is better as it only affects crucial plugins. Your clients will still be able to deactivate other plugins, install new plugins, delete plugins, and update all plugins.

Limiting Plugin Access by User Roles and Permissions

WordPress comes with a built-in user role management system. A default WordPress installation comes with the following user roles:

  • Administrator
  • Editor
  • Author
  • Contributor
  • Subscriber

To learn more, see our complete beginner’s guide to WordPress user roles and permissions.

Only the Administrator user role has permission to manage plugins. If you are making a website for a client, then you can create two user accounts for them.

One with the Administrator privileges, which will allow them to manage the website on their own. After that, you can add a second user account with the Editor user role. Your clients can use it to create content.

This would reduce the chances that they will accidentally deactivate crucial plugins. You’ll need to educate them to use the Administrator account carefully for installing updates or adding new users.

Alternately, you can create a custom user role with a specific set of permissions. This way you can create a user role that can modify themes but cannot manage plugins.

We hope this article helped you learn how to prevent clients from deactivating WordPress plugins. You may also want to see our guide on how to create a custom WordPress login page for your clients.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

94 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

2 Comments

Leave a Reply
  1. Bart Kuijper says:
    Jan 17, 2020 at 12:58 pm

    The article and code are both useful and provide some nice insights. However it’s important to note that using the example code, administrators can still easily disable plugins by simply ticking the box in front of one or more plugins and then selecting ‘Deactivate’ from the ‘Bulk Actions’ drop-down list.

    Reply
    • WPBeginner Support says:
      Jan 21, 2020 at 8:50 am

      Thank you for letting us know, we’ll be sure to look into updating the code when we’re able.

      Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
WP Mail SMTP logo
WP Mail SMTP
Fix WordPress email delivery issues. #1 SMTP plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
LearnDash
LearnDash Coupon
Get the lowest price on the best learning management system (LMS) plugin for WordPress.
AWeber logo
AWeber Coupon
Get a completely FREE plan with AWeber, or 14.9% off the Pro plan. Start your email list today.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.