Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Developer · Guide

What Must-Use Plugins Are and How to Write One

What Must-Use Plugins Are and How to Write One

Short answer

To write a must-use plugin, create a PHP file with a plugin header in wp-content/mu-plugins. WordPress loads it on every request with no activation step, before normal plugins. To turn it off, delete or rename the file, because the dashboard has no deactivation button for it.

Key takeaways

  • A must-use plugin is a PHP file in wp-content/mu-plugins that loads on every request.
  • It needs no activation and cannot be deactivated from the dashboard.
  • Must-use plugins load in alphabetical order, before normal plugins.
  • Activation hooks do not run for must-use plugins, so setup code must not rely on them.
  • Files in subfolders are not loaded on their own, so use a loader file for larger plugins.
  • Update notices do not appear for must-use plugins, so updates are your job.

What is a must-use plugin?

A must-use plugin is a PHP file in wp-content/mu-plugins that WordPress loads on every request, with no activation step.

Developer.WordPress.org states that must-use plugins, also known as mu-plugins, are plugins installed in a special directory inside the content folder, and that they are automatically enabled on all sites in the install (checked November 2026).

The same page states that they do not show in the default list of plugins on the Plugins screen, although they do appear in a separate Must-Use section (checked November 2026).

They cannot be turned off from the dashboard. Developer.WordPress.org states that to disable a must-use plugin, you remove the plugin file from the must-use plugins directory, which is wp-content/mu-plugins by default (checked November 2026).

The same guide is also published in the WordPress documentation. WordPress.org covers must-use plugins in the Advanced Administration Handbook (checked November 2026).

That always-on nature is the whole point. A must-use plugin is for code that must run and must not be switched off by mistake.

A guide on theme vs plugin in WordPress explains how a must-use plugin differs from a theme change and a normal plugin.

When should you use a must-use plugin?

Use a must-use plugin for code that must always run, such as security rules, host integrations, or site setup that must load before normal plugins.

Developer.WordPress.org states that must-use plugins are useful for code that should always run and should not be disabled by accident from wp-admin (checked November 2026).

The handbook lists four common uses: host-specific integrations such as caching or monitoring, site-specific bootstrap code that must load before normal plugins, security or maintenance code that should stay active, and network-wide code on Multisite installs (checked November 2026).

Web hosts use them for the same reason. Developer.WordPress.org states that web hosts commonly use mu-plugins to add support for host-specific features, especially features where removing the plugin could break the site (checked November 2026).

A good test is to ask whether the code could be switched off by mistake without anyone noticing. If the answer is yes and that would be a problem, a must-use plugin fits.

A guide on how to check a plugin for vulnerabilities covers how to review code before you trust it in a folder that cannot be switched off.

When should you not use a must-use plugin?

Do not use the mu-plugins folder for a plugin that needs activation, updates, or an off switch in the dashboard.

Developer.WordPress.org states that you should avoid the mu-plugins directory for plugins that need activation or deactivation from wp-admin, or that depend on activation, deactivation, or uninstall hooks (checked November 2026).

The same page states that you should also avoid it for plugins that need normal update notices in wp-admin, that are meant to be distributed like regular plugins, or that should be optional for site owners (checked November 2026).

A normal plugin is the right home for a feature a site owner may want to turn off. A contact form, a gallery, or a shop add-on should stay a normal plugin.

A must-use plugin is also a poor home for a large feature with its own settings page. Keep it small, reviewed, and documented, so a fault in it cannot take the whole site down.

Developer.WordPress.org states that because must-use plugins always load, you should keep them small, reviewed, and documented, and that a broken mu-plugin can affect the whole site (checked November 2026).

What do you need before you start?

You need file access to the site, a code editor, and a clear, small job for the must-use plugin to do.

File access means SFTP, SSH, or your host file manager. You cannot create a must-use plugin from the WordPress dashboard, because the dashboard has no upload path for that folder.

Work on a staging copy first when the site is live. A must-use plugin loads on every request, so a PHP error in it can break every page, including the dashboard.

Pick one job for the file, such as disabling the file editor or setting a default option. A small file is easy to review, easy to remove, and easy to explain to the next person.

Decide the file name before you write code. WordPress loads the PHP files in the folder in alphabetical order, so the name also sets the load order when you have more than one file.

Check the PHP version your site runs. WordPress.org states that WordPress recommends PHP 8.3 or greater, and that WordPress still works with PHP 7.4 and later in older setups (checked November 2026).

How do you write a must-use plugin?

Create the mu-plugins folder if it is missing, add a PHP file with a plugin header, and write your code inside it.

Follow these steps:

  1. Connect to the site with SFTP or your host file manager.
  2. Open the wp-content folder.
  3. Create a folder named mu-plugins if it does not exist yet.
  4. Create a PHP file inside it, such as mysite-disable-file-editor.php.
  5. Add a plugin header comment at the top of the file.
  6. Add your code below the header.
  7. Save the file and load any page on the site.

The file loads at once. There is no activation step, and no button to click in the dashboard.

A header for the file looks like this:

<?php
/*
Plugin Name: MySite Disable File Editor
Description: Turns off the built-in file editor on every request.
Version: 1.0
Author: MySite Team
*/

The header is the same shape as a normal plugin header. Only the Plugin Name line is required for a normal plugin, and the same rule holds here.

Learn WordPress states that the minimum requirements for a valid plugin are at least one PHP file with an opening PHP tag and a plugin header that names the plugin (checked November 2026).

A small working example disables the file editor:

<?php
/*
Plugin Name: MySite Disable File Editor
Description: Turns off the built-in file editor on every request.
Version: 1.0
Author: MySite Team
*/

define( 'DISALLOW_FILE_EDIT', true );

This example uses a constant WordPress already reads. Your own code will differ, but the shape stays the same: a header, then code that runs on every load.

A guide on how to create a WordPress plugin shows the header fields in full, including version and text domain.

How do must-use plugins load?

Must-use plugins load in alphabetical order by file name, before normal plugins and before the theme.

Developer.WordPress.org states that must-use plugins are loaded by PHP in alphabetical order before normal plugins, and that hooks added in a mu-plugin can apply to normal plugins (checked November 2026).

That early load is why they suit bootstrap code. A filter registered in a must-use plugin is already in place when a normal plugin runs, so it can shape what that plugin sees.

Only PHP files placed directly in the folder are loaded. Developer.WordPress.org states that WordPress only looks for PHP files directly inside the mu-plugins directory, and that files in subfolders are not included on their own (checked November 2026).

For a larger plugin, add a small loader file in the folder root that pulls in the rest:

<?php // mu-plugins/load.php
require WPMU_PLUGIN_DIR . '/my-plugin/my-plugin.php';

Developer.WordPress.org states that you may want to create a proxy PHP loader file inside the mu-plugins directory for this purpose (checked November 2026).

Name the loader so it loads in the order you want. A loader named 00-load.php runs before a file named mysite-rules.php.

FeatureNormal pluginMust-use plugin
Folderwp-content/pluginswp-content/mu-plugins
ActivationManual, from the dashboardAutomatic, always active
DeactivationOne click in the dashboardOnly by deleting the file
Load orderAfter mu-pluginsFirst, alphabetically
Update noticesShown in wp-adminNot shown
Activation hooksRun on activationDo not run

What limits should you know?

Know that activation hooks do not run, update notices do not appear, and subfolders are not loaded on their own.

Activation hooks are not run for must-use plugins. Developer.WordPress.org states that activation hooks are not run for plugins added to the must-use plugins folder, and that plugins which depend on them may not work correctly there (checked November 2026).

That means setup code must run on every load or on a hook that fires each time, not in an activation hook that never fires. Check the code for register_activation_hook before you move a normal plugin into the folder.

Update notices do not appear either. Developer.WordPress.org states that plugins in the must-use directory will not appear in update notices or show their update status on the plugins screen, so you are responsible for learning about and performing updates yourself (checked November 2026).

Keep a record of each file. Developer.WordPress.org states that you should keep a record of why each mu-plugin exists, who maintains it, and how it should be updated (checked November 2026).

The folder can be moved. Developer.WordPress.org states that to change the default directory, you define WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL in wp-config.php (checked November 2026).

A guide on how to find abandoned WordPress plugins explains why a plugin with no update path is a risk, which matters more when the code cannot be switched off.

How do you check that a must-use plugin works?

Check that the file appears under Plugins, then Must-Use, and that its code takes effect on the front end.

Open Plugins in the dashboard and click the Must-Use link at the top of the list. Your file should appear there with the name from its header.

If it does not appear, check three things: the file sits directly in wp-content/mu-plugins, the file ends in .php, and the header comment is at the top of the file.

Then load a page and confirm the effect. For the file editor example, open Tools, then Theme File Editor, and confirm the editor is gone.

If the effect is missing, check that the file name is spelled right and that the code has no PHP error. A syntax error in a must-use plugin can break the whole site, so check the error log when pages fail to load.

A guide on how to remove unused plugins and themes safely covers the safe way to take code off a site when it is no longer needed.

How do you update or remove a must-use plugin?

Update it by replacing the file, and remove it by deleting the file or renaming it so it no longer ends in .php.

There is no update button. Edit the file on staging, check it, then upload the new version over the old one with SFTP or your host file manager.

Keep a copy of the old file until the new one is checked. If the new version breaks the site, restoring the old file brings it back at once.

To turn the code off for a short check, rename the file to end in .php.bak instead of deleting it. WordPress only loads files that end in .php in that folder, so the renamed file stops loading.

To remove it for good, delete the file from wp-content/mu-plugins. The code stops running on the next page load, with no database cleanup step in the dashboard.

Note that uninstall hooks do not run for must-use plugins either. If your code added options or data, delete those rows yourself when the file is removed.

A guide on how to fix a plugin conflict helps when a must-use plugin clashes with a normal plugin and you need to find which one is at fault.

What mistakes should you avoid?

Avoid putting a full plugin in the folder, relying on activation hooks, and hiding the file from the site owner.

Do not move a normal plugin into mu-plugins without reading its code first. A plugin that sets up tables or options in its activation hook will miss that setup, because the hook never fires.

Do not put a large plugin in the folder. A must-use plugin with many files needs a loader, and a fault in any of those files can break every page on the site.

Do not leave a must-use plugin undocumented. A future developer who finds a file in mu-plugins needs to know why it exists, who maintains it, and how to update it.

Developer.WordPress.org states that a compromised mu-plugin can be harder to notice than a normal plugin, because it cannot be disabled from the main plugins list (checked November 2026).

That is a security point, not a detail. Review the folder from time to time, and treat any file you do not know as a reason to ask the host or the last developer who touched the site.

Do not use a must-use plugin for a feature the site owner may want to switch off. A feature with an off switch belongs in a normal plugin, where the dashboard can control it.

Pick a license that works with the GPL when you share the file. GNU.org hosts the full text of the GPL version 2 license (checked November 2026).

Frequently asked questions

Can I deactivate a must-use plugin from the dashboard?

No. A must-use plugin cannot be deactivated from the dashboard, and it shows no update notices. To stop it, delete the file from wp-content/mu-plugins or rename it so it no longer ends in .php. The code stops running on the next page load.

Do activation hooks run for must-use plugins?

No. Activation hooks do not run for must-use plugins, so any setup code that lives in register_activation_hook() will never fire. Put setup that must run on every load in code that runs each time, or keep the plugin as a normal plugin.

Can I use a must-use plugin on a single site, or only on Multisite?

Yes, if the file is placed directly in wp-content/mu-plugins. WordPress loads PHP files in that folder in alphabetical order, before normal plugins. Files in subfolders are not loaded on their own, so use a small loader file for those.

Can I move the mu-plugins folder somewhere else?

Yes, by defining WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL in wp-config.php. The new folder takes the place of wp-content/mu-plugins, and WordPress loads the PHP files from there instead.

Should every custom plugin be a must-use plugin?

Only when the code must always run and must not be switched off by mistake. Security rules, host integrations, and bootstrap code fit. A feature the site owner may want to turn off, or a plugin that needs updates, belongs in wp-content/plugins as a normal plugin.

Why does my must-use plugin not show in the dashboard?

Check that the file is directly in wp-content/mu-plugins, that it ends in .php, and that the header comment is at the top of the file. Then open Plugins and click the Must-Use link at the top of the list to confirm it appears there.

Sources

  1. Must-Use Plugins WordPress Developer Resources
  2. Plugin Basics WordPress Developer Resources
  3. Header Requirements WordPress Developer Resources
  4. Hooks WordPress Developer Resources
  5. Requirements WordPress.org
  6. Must-Use Plugins WordPress.org
  7. Plugin requirements Learn WordPress
  8. GNU General Public License v2.0 GNU.org

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.