New 24/7 monitoring and daily cloud backups now included in every Shield Pro plan.

Security

How to disable WordPress file editing

The built-in theme and plugin editors let Administrators change PHP from the browser. One mistake whitescreens the site. Disabling file editing forces changes through version control or SFTP.

Time: 10-15 minutes Level: Beginner

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.

Edit wp-config.php on a backup copy first. A syntax error in wp-config takes the entire site offline.

Disable file editing constant

Place the line above /* That's all, stop editing! */ in wp-config.php.

php
define( 'DISALLOW_FILE_EDIT', true );

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.

Safer ways to edit code

Use a child theme and deploy changes via SFTP, Git, or CI. Test on staging before production.

BugShield Vault stores hosting credentials so developers edit files without sharing passwords in email.

Optional DISALLOW_FILE_MODS

This stronger constant blocks plugin and theme installation from wp-admin entirely. Use on locked-down enterprise sites where deploys are automated only.

php
define( 'DISALLOW_FILE_MODS', true );

Verify after security plugins

Some security plugins re-enable editors or duplicate the setting. Check effective constants with wp config get DISALLOW_FILE_EDIT on CLI.

When to stop DIY and hire help

Hardening production without breaking agency workflows needs staging exceptions and role planning. BugShield secures WordPress sites on maintenance plans with monitored updates.

FAQs

Will this break the Customizer?

No. Customizer and Site Editor still work. Only direct PHP file editors in admin are removed.

Can I disable editing on multisite only?

Network admins can define constants in wp-config for the entire network. Per-site overrides are uncommon.

How do I re-enable editors temporarily?

Remove or set DISALLOW_FILE_EDIT to false in wp-config.php and reload admin.

Is DISALLOW_FILE_EDIT enough for security?

No. Pair it with strong passwords, 2FA, least-privilege roles, and updated plugins.

Rather someone else fixed it?

Request a fix at a confirmed price. Named UK developer, secure Vault, direct chat.

Request a Fix