Block Plugin Installs With DISALLOW_FILE_MODS

DISALLOW_FILE_MODS blocks every plugin and theme install, update and delete from wp-admin, including WordPress's own automatic security updates.
How common is this?
- 91.9% of the WordPress sites we have this data for fail this check. Platform: WordPress.
Measured across the sites we audit, on each site's most recent snapshot.
What this check and mySites.guru tool looks at on your site
This check reads your site’s wp-config.php for the DISALLOW_FILE_MODS constant and confirms it’s both defined and set to true. If it’s missing, or present but false, the check fails. Because the constant also switches off automatic updates, a passing result on this check is worth cross-referencing against how current your plugins and core version actually are, rather than assuming a strict setting alone means a well-maintained site.
Why a compromised admin reaches for the plugin installer first
If an attacker gets administrator access to a WordPress site, whether through a leaked password, a phished login, or a privilege-escalation bug in another plugin, installing a malicious plugin is usually the very first thing they do. It’s the most reliable way to get persistent code execution: upload a plugin, activate it, and it runs on every page load from then on, survives a core update, and often disguises itself well enough to sit unnoticed for months. DISALLOW_FILE_MODS removes that option entirely by disabling plugin and theme installs, updates and deletions through wp-admin, for every account, compromised or not.
It’s a genuinely stricter setting than DISALLOW_FILE_EDIT, and it implies it: anywhere DISALLOW_FILE_MODS is set to true, the plugin and theme editor is already gone too, whether or not you’ve separately set the narrower constant. That’s the whole trade-off in one sentence: this is the strongest single setting against a compromised admin account installing anything through the dashboard, and it’s stricter precisely because it also removes some things you might still want.
The two constants exist as separate options for a reason, and it’s worth choosing deliberately rather than assuming stricter is always better. DISALLOW_FILE_EDIT alone is a sensible middle ground for a site where an agency or a client still needs to install plugins occasionally through wp-admin, but nobody should ever need the raw code editor. DISALLOW_FILE_MODS is the right call for a site that’s genuinely finished changing, where any install or update is a deliberate, occasional event handled by whoever manages the site, not routine admin-panel work.
What you give up in exchange
The trade-off worth being explicit about is automatic updates. WordPress’s own background update mechanism, the one that quietly applies core security patches without you doing anything, writes files to disk using the same code path that DISALLOW_FILE_MODS blocks. Setting the constant to true doesn’t just stop you installing plugins through wp-admin, it stops WordPress patching itself too. That’s a reasonable trade to make on a site you actively manage and keep an eye on, but it isn’t free, and a site left running with this constant set and nobody checking for security releases is worse off than one running ordinary auto-updates.
This also switches off WordPress’s own security updates
Setting DISALLOW_FILE_MODS means core, plugin and theme auto-updates stop applying in the background as well as manual installs. If you set this, you need another way to know when a security release is out, whether that’s mySites.guru’s version checks, a WordPress mailing list, or a habit of checking regularly.
How to fix it
- Connect to your site via SFTP, SSH, or your hosting file manager, and open
wp-config.phpin the site root. This is the same fileDISALLOW_FILE_EDITlives in, so if you’ve already set that constant, you’re adding this one alongside it, not replacing it. - Add the constant above the
/* That's all, stop editing! Happy publishing. */line:
define( 'DISALLOW_FILE_MODS', true );
- Confirm it took effect: log into
https://yoursite.com/wp-admin, and check that Plugins → Add New and the plugin/theme editor screens are no longer available anywhere in the dashboard. - Decide how you’ll track security releases now that background updates are blocked. That might be watching the WordPress security release announcements, or relying on mySites.guru’s own version checks against your connected sites.
- When you genuinely need to install or update something, remove or comment out the constant, make the change through wp-admin as normal, then set it back to
trueafterwards. Installing over SFTP or WP-CLI works at any time regardless of this setting, since neither goes through the code path the constant restricts. - On a multisite network, this constant lives in the single, shared
wp-config.php, so setting it applies to every site in the network in one go rather than needing repeating per site.
What mySites.guru does about it
mySites.guru checks every connected WordPress site for this constant on each snapshot, twice a day, and can set DISALLOW_FILE_MODS to true in wp-config.php with one click, across every connected site at once, rather than editing each one by hand. Because the trade-off here includes losing automatic security updates, mySites.guru’s own version tracking on every connected site becomes the backstop that keeps you from missing one.
Block Plugin Installs With DISALLOW_FILE_MODS
mySites.guru checks every connected site for this automatically and flags it the moment it appears. These run twice a day on every connected site.
It can also fix this across every connected site with one click.