Automatic Activation of Plugins


A long time “want” for WordPress, especially since dealing with a large number of blogs at b5media, has been to have a WordPress MU feature that provides a directory whereby all plugins are automatically activated. I have asked for it on back channels for several months now, but it wasn’t until recently that I realized how simple (and how backwards) the same functionality could be. I have to give credit to Barry and Matt at Automattic for pointing this out to me. Oh, Ryan did too.

The answer is the long-time hidden resident of WordPress, the my-hacks.php file. You create a plugin directory where all plugins will be activated from (we call it b5-plugins), and then simply update the my-hacks file as such:

1
2
3
<php
require_once(‘wp-content/b5-plugins/my-plugin.php’);
?>

We could probably go one better and read all the files in that directory into an array an execute, but my security fritz goes off when I get to that level of blind automation.