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

How to Disable Theme and Plugin Editors from WordPress Admin Panel

Last updated on by
Elegant Themes
How to Disable Theme and Plugin Editors from WordPress Admin Panel

By default WordPress allows users to edit the theme and plugin codes through the admin panel. While it is a handy feature, it can be very dangerous as well. A simple typo can end up locking you out of your site unless ofcourse you have the FTP access. To prevent clients from screwing up the site, it is best to disable the theme and plugin editors from the WordPress admin panel. In this article, we will share with you a one line code that will disable theme and plugin editors functionality from WordPress.

All you have to do is open your wp-config.php file and paste the following code:

define( 'DISALLOW_FILE_EDIT', true );

And you are done.

One of our users pointed out that if you paste this code in the theme’s functions.php file, it also works.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Gray Ayer says:

    A problem encountered with this technique is that it also prevents anyone from upgrading the outdated plugins. Any ideas on that, besides disabling the addition to the wp-config file, upgrading, then restoring the hardened security?

    • Editorial Staff says:

      That’s interesting. We have this code running on our site, and we can do 1-click upgrades.

  2. joanpique says:

    Hi, thanks for the tip, yes, it works on functions.php file.

    But this code turn me off my theme options page :( …, is there any other code that only hide editors or something to put in the options page for avoid hidding?

  3. Devin Walker says:

    99% of my clients are non-technical

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.