Mandatory plugins in sage theme

Hi sage community,

I would like to make ACF pro a mandatory activated plugin for my theme. When it is not active, the user should not be able to do things in wp-admin. Is there a mechanism for doing this without manual if conditions?

Thank You!

If you are using Bedrock, just install it into app/mu-plugins and it wont be able to be deactivated.

1 Like

Great! Thank you for that quick answer.

To manage this in composer directly you can add extra installer-paths for the plugins.

"extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": [
          "type:wordpress-muplugin",
          "wpengine/advanced-custom-fields-pro"
      ],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },

Here I’ve used the package name for their acf pro package

Composer provides an example with akismet here https://wpackagist.org/

2 Likes

This is also documented at Must-use Plugin Autoloader | Bedrock Docs | Roots

1 Like

When it comes to actually developing with ACF as an MU plugin, things got a little weird for me. Though I don’t recall exactly what, it’s been a while. Anyways, if that happens to you, you could alternatively hide the plugin from the plugins list and hide the settings panel from the admin. There are lots of instructions for this online.