Disabling file editing from the WordPress dashboard enhances the security of your site by preventing users from modifying core files or themes directly through the web interface. This procedure is performed by a Site Administrator within the WordPress dashboard.
Before you begin
You will need:
Site Administrator access to your WordPress dashboard.
A way to access your site's files via FTP or a File Manager (such as those provided in your hosting control panel) to verify the change.
Disabling file editing via wp-config.php
To disable the ability to edit files directly from the WordPress dashboard, you must modify the wp-config.php file located in your site's root directory.
Access your site's files using an FTP client or your hosting provider's File Manager.
Locate the
wp-config.phpfile in the root directory of your WordPress installation.Open the file and search for the following line:
define( 'DISALLOW_FILE_EDIT', false );Change the value from
falsetotrueso the line reads:define( 'DISALLOW_FILE_EDIT', true );Save the changes to the file.
Note: If the line does not exist in your file, you can add it manually before the line that says /* That's all, stop editing! Happy blogging. */.
Confirm the result
To verify that the change was successful, log in to your WordPress dashboard.
Navigate to Plugins > Plugin File Editor or Appearance > Theme File Editor.
You should see a message stating that "Editing files is currently disabled for security reasons."
The options to select a file or view the code editor should no longer be available.
Limitations
This change is a global setting. Once enabled, no users—including administrators—will be able to use the built-in WordPress editor to modify theme or plugin files. If you need to make changes to your site's code, you must use an FTP client or a File Manager.
