Like a lot of devs, I’m sadly addicted to all the many tips and how-tos and tutorials that float around in the WPverse. Some of them are utterly brilliant. A very few of them open my eyes to new ways of doing things that I couldn’t even have imagined doing the old way. But far more often, I follow a link that leads to the other kind of tuts. The ones that promise that by just copying a few lines of code, you can do magical things without needing to use any plugins at all!
There’s just one problem with this. Plugins exist for a very good reason: to add non-core functionality 1 to your site without hosing up the whole lot.
Much more importantly, a plugin is the right way to do it the great majority of the time. There’s a whole Plugin API that exists just to make it possible to hook your code to WordPress with minimal fuss! Those really cool new features you love were first tried out and gained traction as plugins! And anyway, there are really only two other choices:
- Edit your theme’s functions.php. This works just fine, because code in functions.php will be included just the way a plugin would be2. Except for the small fact that now you — and more importantly, your users and clients — are stuck with that theme. Wanna change themes as your mood strikes you? Or just update to a newer version? Say goodbye to all that new functionality. As one friend of mine puts it, when you repaint the bathroom, you don’t normally expect the toilet to vanish…
- Hack core. Congratulations, you have now fucked your site. At best, you’re now unable to upgrade WordPress (including security updates) without losing your tweaks. At worst, you’ve introduced entirely new issues: because if you’re hacking core just to add a new widget or dongle or gizmo, you probably didn’t read the code all that carefully, now did you?
Pingback: “Without a plugin” considered dangerous | sabreuse | Ipstenu on Tech
Whenever I see someone claim that they need to hack core WordPress to enable certain functionality, I suggest that they don’t use WordPress and instead build from scratch.
Pingback: Why You Shouldn't Use Plugins | Ipstenu on Tech