Why and How to Disable WordPress Theme and Plugin Editor
Learn why disabling the WordPress file editor is essential security. Prevent attackers from injecting malware through the dashboard.
WordPress includes a built-in editor for modifying theme and plugin files directly from the dashboard. While convenient, this feature is a significant security risk that should be disabled on production sites.
The File Editor Risk
What the Editor Does
Appearance > Theme Editor and Plugins > Plugin Editor allow:
- Modifying any PHP file in themes
- Modifying any PHP file in plugins
- Immediate execution of changes
- No version control or backup
Security Implications
If an attacker gains admin access (through stolen credentials, privilege escalation, or other means), they can:
- Inject backdoors into theme files
- Add malware to plugin files
- Create persistent access
- Hide malicious code in unused files
Common Attack Scenario
- Attacker compromises admin account
- Opens Theme Editor or Plugin Editor
- Injects backdoor code
- Backdoor persists even after password change
- Attacker has permanent access
How to Disable the File Editor
Method 1: WP Folder Shield (Recommended)
- Navigate to WP Folder Shield > Settings
- Enable "Disable File Editor"
- Save changes
Editor menu items are removed completely.
Method 2: wp-config.php
Add this line to wp-config.php:
define('DISALLOW_FILE_EDIT', true);
Place it before "That's all, stop editing!"
Method 3: Also Disable Plugin/Theme Installation
For maximum security:
define('DISALLOW_FILE_MODS', true);
This also disables plugin/theme updates from dashboard.
What Disabling Does
- Removes Theme Editor from Appearance menu
- Removes Plugin Editor from Plugins menu
- Blocks direct access to edit URLs
- Forces file changes through FTP/SFTP
When NOT to Disable
Development Sites
On local or staging sites, the editor can be convenient. Just ensure it's disabled in production.
Managed Hosting
Some managed hosts disable it automatically.
Alternative Editing Methods
With the editor disabled, edit files via:
- FTP/SFTP: Secure file transfer
- SSH: Command line access
- File manager: cPanel or hosting control panel
- Local development: Edit locally, deploy to server
All these methods provide better security (audit trails, backups) than the dashboard editor.
Get WP Folder Shield to disable the file editor and protect against admin account compromise.
Written by Sarah Chen
WP Folder Shield Team