How to Disable Theme or Plugin File Editing in WordPress

WordPress

WordPress comes with a built-in code editor that allows users to edit theme and plugin files directly from the WordPress admin area. It is a plain code editor that lets you make changes in themes or plugins at the code level. Theme Editor is located in Appearance -> Theme Editor and Plugin Editor can be found in Plugins -> Plugin Editor.

Whenever you try to access these sections for the first time, WordPress also warns that using the editor can break your website if you do something wrong.

If you are not good at coding, making the wrong change will break your website. The good thing is that the latest editors can now catch most of the fatal errors and revert back the changes.

The built-in file editor gives full access to the theme and plugin code. If you do not want this section to appear in your WordPress admin area, you can simply disable it. There is no native option to enable or disable this. you to edit the WordPress configuration file to disable the file editor in WordPress.

In this article, I will tell you how you can disable theme editor and Plugin editor section in WordPress to prevent code changes from WordPress dashboard.

Disable Theme and Plugin Editors in WordPress

You need to simply add a one-line code in a wp-config.php file located at the root of your WordPress installation. To get access to this file, you can either use FTP or the file manager of your hosting panel.

Just add the following code before the line saying, ‘That’s all, stop editing! Happy publishing.’

define( 'DISALLOW_FILE_EDIT', true );
Disable File Editing in WordPress

Then save the wp-config.php file.

Now the plugin and theme editors will not appear in the WordPress admin area. See the snapshot of the WordPress Theme section. There is no Theme Editor option.

Disable Theme or Plugin File Editing in WordPress

Wrap Up

WordPress is built-on PHP. If you want to do changes in themes or plugins, you need to know PHP properly. If you or other people managing the website are not good in PHP, it is a good idea to disable the file editing in WordPress. Adding the given line also requires knowledge of PHP. If you do something wrong, it will take down your website.

I hope this article was useful. If you have any questions, you can ask using the comments.


Deepanker Verma is experienced WordPress developer who can code WordPress Themes and Plugins. Here, he will be writing about WordPress guides.


Similar Articles

0 Comments

Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

© 2022 The WP Guides Developed By Deepanker