How to Disable File Editing in the WordPress Admin Panel

With an urge to secure the WordPress website, I always seek the possible ways to find a vulnerability and remove it.

There are many website owners, who are struggling to understand the WordPress CMS(Content Management System). I remember when I used to freak out, but not anymore.

If you scan your WordPress admin panel, you may find an option to edit your WordPress theme's coding files, and so does for the plugins.

It's possible that hackers can inject some malicious code to these files and the website may never be as it is now. It's essential to stop such access directly to the coding files of your WordPress website through its admin area.

If you want to edit something, it's better to use cPanel.

Let me show you a screenshot to find the editing option. Login to your WordPress admin panel, go to Appearance>>Editor, this editor option is to modify your WordPress theme code.

How to Disable File Editing in the WordPress Admin Panel

For plugins, go to Plugins>>Editor. You can see an example of the code editor below.

How to Disable File Editing in the WordPress Admin Panel

In this tutorial, you're going to learn about removing these editors from the WordPress dashboard, so that even if someone hacks your website by brute force attack, they can't mess up with the coding files.

Edit the wp-config.php File to Stop File Editing

The .htaccess and wp-config.php are the two most vital files of a WordPress site. In most of the cases, whenever you require to add or improve any functionality, you ought to use these files.

To remove the file editing option from the WordPress admin panel, you must use the wp-config.php file; I hope you know how to locate it.

Follow these steps.

Step 1

Open cPanel and look for the file manager. As you know, the file manager consists of all of your websites' data.

How to Disable File Editing in the WordPress Admin Panel

Even if you host multiple websites on your single web hosting server, you can easily find their core files and folders. Depending on the web hosting company you have, without getting confused with the design of cPanel, you should try finding the file manager and open it.

Step 2

Make sure you open the public_html directory, make people also call it a root directory. If you see a blank page, navigate to the public_html from the vertical menu on the left side of the screen.

How to Disable File Editing in the WordPress Admin Panel

Step 3

If you host only one website, you may find all the files and folders in the root directory. If not, you may have to see another folder.

How to Disable File Editing in the WordPress Admin Panel

Search for the wp-config.php file by scrolling down and right-click to edit. You can also choose an Edit option from the main navigation menu of cPanel.

Step 4

Once you choose to edit, you can see a popup to confirm the editing of this file. It's a necessary step because cPanel authenticates your access.

How to Disable File Editing in the WordPress Admin Panel

Click Edit; a new tab opens in the browser.

Step 5

You can see a bunch of coding lines. Well, no need to be scared, all you need is copy the code and paste it at the bottom of all the other codes of the file.

define( 'DISALLOW_FILE_EDIT', true );

Click Save Changes from the top-right corner of the screen to save the file.

Now login again to the admin panel of your website and check if you see the Editor option for themes and plugins. If not, you have successfully disabled the file editing from WordPress dashboard.

How to Disable File Editing in the WordPress Admin Panel

From now onwards, no one will be able to edit the coding file of your WordPress themes and plugins, not even you.

If you want to modify something, it better to use cPanel. Nowadays, almost every web hosting company offers cPanel account, even with their starter plan.

Can You Now Stop Everyone from Editing the Coding Files through Website's Dashboard

One of the best ways to start securing your website is from its admin panel. Millions of websites face havoc through the login page, which leads to malicious code injection to plugin and theme coding files.

The worst part is that it's hard to fix a website when it's hacked by injecting a bad code. There are tons of coding files on a plugin or a theme; you can't go through all of them.

So why not take the initiative to remove the editor? I hope you can easily accomplish such a task.

Conclusion

Once in a while, a WordPress beginner asks the questions related to the website's security, and I always recommend them to learn the basics.

Securing a WordPress site is easy only if you have a look at the possible vulnerabilities. I am sure, you can easily disable file editing from the dashboard.

Check out these top 3 WordPress hosting services:

Was this article helpful?