Running a WordPress Plugin, always…

Development
As seen on my local WP development environment
As seen on my local WP development environment

Sometimes you’ve created a site with WordPress standard (not single user), but have had allow the site owners or users to have full admin access to it.  You have plugin and theme dependencies, and if the site owner disables that plugin, you have problems.

For example, you’ve written a plugin that carries out a certain range of syndication functions for your client.  If the client accidentally disables it he will lose money, and you will have a call-out, potentially an angry one, when he finds out.  He wants admin access, but you know he’s dangerous with it.

So, since WordPress 2.8 you’ve had the facility to create a folder in wp-content called mu-plugins.  It will work just like the mu-plugins folder in WordPress MU – as in, any plugin placed there, will run automatically.  Activation code won’t fire off, but apart from that, so long as the plugin is correctly written, everything will work.

I’m not sure if this change is a part of allowing ‘must-use’ plugins support, as suggested in http://core.trac.wordpress.org/changeset/10737 or if it’s also planned as part of the move towards merging WP single user and WP-MU.  Either way, it’s an incredibly useful tool for those of us who set up and configure sites for clients who are a little prone to fiddling.

Watch out for plugin updates – you can’t auto-update anything in mu-plugins, and you won’t receive any notifications.  Be aware that you have to stay on top of this by yourself, just like in the old days!

David Coveney

David Coveney

Dave has been working in software development since 1988, starting with payroll development and then ERP consultancy for large corporates. He is a keen traveller, photographer and motorsport enthusiast, but now puts family first as he’s massively in love with his two little boys. Dave is still an early adopter. He was connected to the internet from his bedroom, way back in the eighties, had a personal website by 1994, was into the connected house in the late '90s, a smartphone by 2002, and a was the first in the office with a fitness tracker.