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

Question

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?

0
2 months 2022-11-30T07:57:58-05:00 0 Answers 0 views 0