Your prompt

Take a backup of my site, then add this to wp-config.php above the line that says “That’s all, stop editing!”: define( 'DISALLOW_FILE_EDIT', true );  Confirm the site still loads afterwards.

What this prompt does

This prompt asks your AI assistant to add DISALLOW_FILE_EDIT, set to true, to wp-config.php. It removes the built-in Theme File Editor and Plugin File Editor from the WordPress admin, so nobody can edit code directly from the dashboard.

That matters for security. If an attacker gets into an administrator account, those editors let them change PHP files straight away. Removing them closes one easy route.

It does not stop plugin or theme installs, which is a different setting. You can still edit code through your host, SFTP or other tools.

Hardening of this kind is cheap and has little downside for most sites, because developers normally edit files over SFTP or in version control anyway, and not in the browser. It simply removes a convenient tool for someone who should not have it. Tell anyone on your team who uses the dashboard editor before you make the change, so it does not come as a surprise to them. Also remember that wp-config.php is a file on the server, so your assistant needs file access to edit it; if it has none, it should say so and give you the line to paste yourself.

Before you run it

As with any wp-config.php change, a typo can break the site.

  • Take a backup as instructed, and make sure you have file access through your host.
  • Confirm nobody on your team relies on the dashboard file editor. If they do, tell them how else to make code changes.
  • Have the assistant show the edit before saving.
  • Check the constant is not already set to something else.

This setting does not replace strong passwords, updates or two-factor sign-in. It is one layer among several.

What to check afterwards

  • The site and admin both load.
  • Appearance and Plugins no longer show the code editor links.
  • Visiting the editor’s address in the admin shows no editing screen.
  • The line sits above the stop-editing comment.
  • You can still update and install plugins as before.

Ways to adapt it

  • Go further: Also explain what DISALLOW_FILE_MODS does and whether I should use it.
  • Add a review: Check my administrator accounts at the same time.
  • Reverse it: Remove the line again so I can use the editor.

If it goes wrong

  • You need to edit a file in a hurry. Use SFTP or your host’s file manager, or temporarily remove the line.
  • A white screen. Restore wp-config.php from backup.
  • The editor is still visible. Another plugin or a duplicate definition set it to false, so search for it.

Related reading includes the WordPress security guide and the security risks of AI agents.

← Every prompt on WPMusk

SponsoredNibWP

Stop clicking. Start telling.

Ask your AI to build pages, fix speed and nail SEO, and NibWP does it on your WordPress site in minutes.

Try NibWP.com

Get the WPMusk Sunday brief

One email a week with our newest tutorials, honest tool reviews and resources you won’t find on the blog. No spam, unsubscribe in one click.

Newsletter (Sunday brief)