What this problem looks like
DISALLOW_FILE_EDIT removes the Theme Editor and Plugin Editor submenus. It does not stop uploads or plugin installs by itself.
Compromised admin accounts cannot use the dashboard to drop PHP backdoors into theme files when editing is disabled, though they may still upload malicious plugins without broader hardening.
Step 1: Disable file editing constant
Open wp-config.php in your site root, next to wp-admin and wp-content. Search for DISALLOW_FILE_EDIT first. If the line already exists, set it to true instead of adding a duplicate. If it does not exist, paste the constant above the line that says stop editing:
define( 'DISALLOW_FILE_EDIT', true ); Step 2: What this does and does not block
- Removes Appearance → Theme File Editor.
- Removes Plugin → Plugin File Editor.
- Does not block plugin installation or updates.
- Does not replace SFTP access for attackers with stolen credentials.
Step 3: Safer ways to edit code
Use a child theme and deploy changes via File Manager, SFTP, Git, or CI. Test on staging before production.
Step 4: Optional DISALLOW_FILE_MODS
Search for DISALLOW_FILE_MODS in wp-config.php first. If the line already exists, update it instead of adding a duplicate. If it does not exist, add this stronger constant above the stop editing line:
define( 'DISALLOW_FILE_MODS', true ); Step 5: Verify after security plugins
Some security plugins re-enable editors or duplicate the setting. Check effective constants with wp config get DISALLOW_FILE_EDIT over SSH.
When to stop DIY and hire help
Hardening production without breaking agency workflows needs staging exceptions and role planning. BugShield secures WordPress sites at a confirmed fixed price with monitored updates.