Skip to main content

Must-use plugins

Must-use ("MU") plugins are always active. There's no Enable / Disable button, no entry in settings.enabledPlugins, no way to switch them off from the admin UI.

They power features the rest of the admin (or the typical user's published site) assumes is present:

  • The post / page editor relies on the flexweg-blocks plugin to provide the core block set.
  • Sites with analytics or a chat widget can't have those scripts disappear when someone toggles a plugin off — flexweg-custom-code is must-use to prevent that footgun.
  • Embeds inserted in posts (YouTube, Vimeo, Twitter, Spotify) would silently turn into broken markers if flexweg-embeds were disabled.
  • Favicons + the PWA manifest are something every public site benefits from — flexweg-favicon ships always-on.
  • The dashboard's metrics cards (storage usage, Firestore document counts) come from flexweg-metrics.
  • The CSV / WordPress import flow lives in flexweg-import so it can ship + iterate independently.

Where they appear in the admin

/plugins splits two tabs:

  • Plugins — regular plugins, with Enable / Disable buttons.
  • Must-use — MU plugins, each card showing a Must-use badge and no toggle.

Both kinds have settings pages reachable via /settings/plugin/<id> exactly the same way. getPluginManifest(id) searches both registries so the URL form is uniform.

Source location

Must-use plugins live at src/mu-plugins/, separate from the regular src/plugins/ folder. The boot code's plugin loader iterates MU_PLUGINS first on every applyPluginRegistration() pass without consulting enabled. So toggling unrelated plugins on/off cannot deregister an MU plugin.

Why some plugins are MU vs. optional

The decision criterion is what breaks if the plugin is disabled mid-life:

If disabled, what happens?Status
The site keeps working as before (e.g. SEO meta tags stop appearing — fine)Optional plugin
Existing content silently breaks (e.g. blocks disappear from the editor, embeds stop rendering)Must-use
Site-wide injected scripts (analytics, chat widget) get stripped from every regenerated pageMust-use

If you're authoring a new plugin and unsure, default to optional — admins value the toggle. Promote to MU only if there's a real footgun.

Disabling MU plugins (advanced)

There's no UI for it. The only way is to remove the plugin's manifest entry from src/mu-plugins/index.ts and rebuild the admin. Most admins should never need to.

Continue