A hacked WordPress admin account can turn a tiny edit into a full website problem. The built-in file editor gives privileged users a direct path to your theme and plugin code.
If you want to disable WordPress file editor, you don’t need another plugin. One line in wp-config.php removes the Theme File Editor and Plugin File Editor from wp-admin. Code changes then happen through a controlled server tool instead.
We recommend this setting for business sites, especially when several people manage content or plugins. The change takes minutes, but the code must sit in the right place.
Why disable the WordPress theme and plugin editors?
WordPress includes browser-based editors under Appearance > Theme File Editor and Plugins > Plugin File Editor. They can be useful for quick changes, but they also put sensitive files close to the login screen.
If someone gains administrator access, they may use the editor to add malicious code, create a backdoor, or break a plugin. A small account security issue can become a site recovery job.
The editor also makes accidental damage easier. One missing character in a PHP file can trigger a critical error and take your site offline. Editing files through cPanel, SFTP, or SSH creates a more deliberate process.
We don’t treat this setting as a complete security solution. We treat it as one sensible lock on an unnecessary door.
DISALLOW_FILE_EDITremoves the dashboard editors, but it doesn’t stop file changes through SFTP, SSH, or a hosting file manager.
How to disable WordPress file editor in wp-config.php
Before editing a configuration file, create a current backup of your WordPress files and database. If something goes wrong, a backup gives you a clear way back.
You’ll need access to the WordPress root directory. Most hosting accounts provide this through cPanel File Manager. You can also use SFTP or SSH if those tools are part of your hosting plan.
Follow these steps:
- Open the WordPress root folder, often named
public_html, and locatewp-config.php. - Download a backup copy before making any changes.
- Open the file in the hosting editor or a plain-text code editor.
- Add the following line above the comment that says
/* That's all, stop editing! Happy publishing. */. - Save the file and return to your WordPress dashboard.
define( 'DISALLOW_FILE_EDIT', true );
The spelling, capital letters, brackets, and semicolon all matter. Add the line only once. Avoid placing it inside another setting or PHP statement.
You won’t need to restart the web server. Reload the dashboard, then check the Appearance and Plugins menus. The file editor options should no longer appear. one.com’s file-editing guide also recommends adding this constant in wp-config.php.
When to use DISALLOW_FILE_MODS instead
Sometimes you want to block more than code editing. WordPress also supports the DISALLOW_FILE_MODS constant:
define( 'DISALLOW_FILE_MODS', true );
This setting disables the Theme and Plugin File Editors, along with dashboard actions that modify plugin and theme files. That includes installing, updating, and deleting plugins or themes through wp-admin.
Use it on tightly controlled sites where updates happen through a maintenance process, staging site, or hosting team. It can be too restrictive for a small business owner who handles regular updates from the dashboard.
For most sites, DISALLOW_FILE_EDIT is the better starting point. It removes the risky browser editor while leaving normal plugin and theme management available.
Don’t add both settings unless you have a clear reason. DISALLOW_FILE_MODS already disables the editors, so the narrower setting adds little in that situation.
Check the change and recover safely
After saving wp-config.php, sign in again and look for the editor links. Administrators should no longer see Theme File Editor under Appearance or Plugin File Editor under Plugins.
Try opening the old editor address directly if you want an extra check. WordPress should block access or show a permissions message instead of loading the editing screen.
Need to restore editor access temporarily? Remove the line, or change true to false, then save the file again. We recommend turning the editor off once the emergency change is complete.
If the site shows a critical error after saving, don’t keep editing randomly. Replace the file with your backup, or remove the new line through cPanel File Manager or SFTP. Your hosting provider’s support team can often help restore access without changing the rest of the site.
Know what this setting doesn’t protect
Disabling the editor only blocks changes made through the WordPress dashboard. It doesn’t prevent someone with hosting credentials from changing files through cPanel, SSH, SFTP, or another file manager.
It also doesn’t fix vulnerable plugins, weak passwords, stolen login cookies, or an outdated WordPress installation. Keep WordPress, themes, and plugins updated. Use strong, unique passwords and enable two-factor authentication where available.
Regular backups matter too. A security feature can reduce risk, but a clean backup is what helps you recover when prevention fails.
For another layer, add malware scanning, login protection, and monitoring through reliable website security features. Jetpack’s security guidance also treats file editor restrictions as one part of broader WordPress protection.
Make WordPress administration easier with ZADiC
Safe maintenance shouldn’t require you to become a server administrator. Your hosting should give you a clear way to manage files, restore backups, and get help when a configuration change causes trouble.
Our ZADiC WordPress hosting plans provide WordPress hosting with cPanel access, one-click setup, free SSL on many plans, and 24/7 human support. That gives you a practical alternative to making sensitive edits inside the WordPress dashboard.
You can disable the editor in wp-config.php, handle approved changes through cPanel, and add security monitoring as your site grows. Fewer risky shortcuts. More control when you need it.
Conclusion
A single DISALLOW_FILE_EDIT line can remove the WordPress theme and plugin editors from wp-admin. Back up your site first, place the code above the WordPress stop-editing comment, and check both dashboard menus afterward.
The setting won’t replace updates, strong login protection, or backups. It closes one unnecessary access point, giving your site a safer and more controlled maintenance routine.






