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_EDIT removes 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:

  1. Open the WordPress root folder, often named public_html, and locate wp-config.php.
  2. Download a backup copy before making any changes.
  3. Open the file in the hosting editor or a plain-text code editor.
  4. Add the following line above the comment that says /* That's all, stop editing! Happy publishing. */.
  5. 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.

We use cookies so you can have a great experience on our website. View more
Cookies settings
Accept
Decline
Privacy & Cookie policy
Privacy & Cookies policy
Cookie name Active

Who we are

Our website address is: https://zadic.net.

Comments

When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection. An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.

Media

If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.

Cookies

If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year. If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser. When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed. If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.

Embedded content from other websites

Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website. These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.

Who we share your data with

If you request a password reset, your IP address will be included in the reset email.

How long we retain your data

If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue. For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.

What rights you have over your data

If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.

Where your data is sent

Visitor comments may be checked through an automated spam detection service.
Save settings
Cookies settings