Closed szepeviktor closed 6 years ago
My suggestion would be to employ a muplugin-loader package for this purpose, like
https://github.com/bueltge/must-use-loader
or
https://github.com/lkwdwrd/wp-muplugin-loader
But yeah, since it gets installed in a subfolder, it won't show up in a plain composer installation as WP will only load top-level php files as mu-plugins. I guess this warrants a note in the README, agreed
Thank you.
I consider putting a complete plugin among MU plugins an anti-pattern. An MU plugin should be UI-less and tiny.
This is a small MU plugin against must-have plugin deactivation :) https://github.com/szepeviktor/wordpress-plugin-construction/tree/master/mu-protect-plugins
It's just the nature of using composer that packages get installed in subdirectories which conflicts with the way WP will attempt to load mu-plugins.
This does not have anything to with loading regular plugins as mu-plugins (although this becomes possible due to the similar folder/file structure).
This is just a situation where you can't please everyone:
and so far nobody has complained
I try to keep all sites' code base as small as possible, sparing single lines!
Sorry, I am unable to see the connection between that comment and the quote it's referring to.
The linked plugins like bueltge/must-use-loader are hundreds of line for only 1 require statement.
I could imagine a Composer loader that creates one file for every MU plugin, e.g. require __DIR__ . '/wp-stash/wp-stash.php';
I see. Yes. We also use "handwritten" mu-loader-scripts in a couple of projects where WP Starter is not an option.
This is of course entirely down to personal preference.
When I linked bueltge/must-use-loader
earlier, I admittedly only checked if it roughly did what I expected it to do based on the readme. On closer inspection during updating the WP Stash docs, I realized that it is indeed a kinda weird solution for the problem at hand. So I did not include it as a recommendation in the docs.
Thank you @Biont !
Should I add
wp-content/mu-plugins/wp-stash.php
withwhen I use composer without WP Starter? Could you include it in the README?