At this point in time, WordPress remains the easiest-to-use “CMS” available to us, so I end up developing quite a few sites with it. Somehow, there is this great feature I’ve never heard of until a few weeks back, so I thought I’d share with the class.
WordPress has this feature called “Must Use Plugins“, aka mu-plugins. They go in the directory
/wp-content/mu-plugins/ which does not exist by default. WordPress will load every .php file in that top level directory, before regular plugins. In my efforts to write less crappy code on WordPress, this directory has proved invaluable. However, rarely do you want a bunch of .php files in that directory. Normally, you’d want a system more like the regular plugin directory where each plugin can be a file OR a directory.
I wrote up a little proxy loader script that accomplishes this. Just save as
/wp-content/mu-plugins/proxy-loader.php or something, and it will load either
/wp-content/mu-plugins/<plugin-name>/plugin.php if those files exist. The plugin is available via GitHub.