Skip to main content
added 329 characters in body
Source Link
O. Jones
  • 483
  • 5
  • 21

I have a couple of plugins that need to install drop-in modules or mu-plugin modules when they're activated, and remove them when they're deactivated.

This requires copying -- or maybe symlinking -- a php file from someplace in my plugin's directory to either wp-content/ or wp-content/mu-plugins/ on activation.

On deactivation it requires removing that php file.

Why do this? One plugin, still in development, is a persistent object cache to use SQLite as a backing store. That requires a drop-in.

The other plugin requires hooking some stuff that happens during core version upgrades. Ordinary plugins aren't active during those version upgrades, so the mu module is necessary. (sigh)

This can get gnarly on installations with weird file permissions, or when the site owner wants to use composer to configure plugins.

Is there a canonical, worked-out, official way to do this?

I have a couple of plugins that need to install drop-in modules or mu-plugin modules when they're activated, and remove them when they're deactivated.

This requires copying -- or maybe symlinking -- a php file from someplace in my plugin's directory to either wp-content/ or wp-content/mu-plugins/ on activation.

On deactivation it requires removing that php file.

This can get gnarly on installations with weird file permissions, or when the site owner wants to use composer to configure plugins.

Is there a canonical, worked-out, official way to do this?

I have a couple of plugins that need to install drop-in modules or mu-plugin modules when they're activated, and remove them when they're deactivated.

This requires copying -- or maybe symlinking -- a php file from someplace in my plugin's directory to either wp-content/ or wp-content/mu-plugins/ on activation.

On deactivation it requires removing that php file.

Why do this? One plugin, still in development, is a persistent object cache to use SQLite as a backing store. That requires a drop-in.

The other plugin requires hooking some stuff that happens during core version upgrades. Ordinary plugins aren't active during those version upgrades, so the mu module is necessary. (sigh)

This can get gnarly on installations with weird file permissions, or when the site owner wants to use composer to configure plugins.

Is there a canonical, worked-out, official way to do this?

Source Link
O. Jones
  • 483
  • 5
  • 21

Is there a canonical way for a plugin to install a mu-plugin or drop-in?

I have a couple of plugins that need to install drop-in modules or mu-plugin modules when they're activated, and remove them when they're deactivated.

This requires copying -- or maybe symlinking -- a php file from someplace in my plugin's directory to either wp-content/ or wp-content/mu-plugins/ on activation.

On deactivation it requires removing that php file.

This can get gnarly on installations with weird file permissions, or when the site owner wants to use composer to configure plugins.

Is there a canonical, worked-out, official way to do this?