One of the most popular plugins on the WordPress store is WPCode, and for good reason. It’s a great way for those new to WordPress to easily add code snippets to their installation. You can individually enable and disable specific pieces of code and even insert JavaScript into specific portions of your site conditionally. The latter functionality allows you to selectively add analytics code, so it doesn’t track logged-in users.
In fact, I even reviewed WPCode on the NameHero Startup blog and gave it a glowing recommendation. So why don’t I use it myself? Here are two reasons why I gave it up.
I Didn’t Like the Loss of Control
Custom code on WordPress is naturally a bit riskier than well-maintained plugins. And despite the best efforts of WPCode to disable WordPress snippets that crash your site, the occasional error slips through. I’ve experienced it myself.
I live in perpetual paranoia of breaking my site. Because of this fear, I set things up so that I can easily recover from a site crash. If I know that a certain plugin is breaking my site, I can easily disable it via the file manager. Once I fix the problem, I can re-enable it as needed.
But if a custom snippet on WPCode crashes my WordPress site and I’m forced to disable the plugin entirely, how do I get the rest of the snippets to start working? Obviously, I’ll have to re-enable WPCode, find the offending snippet, and disable only that one. But I can’t help feeling uneasy that my custom snippets were not entirely under my control. If WPCode itself crashes, I’ll lose access to all my snippets.
WPCode Isn’t an Ordinary WordPress Plugin
You might counter that we face this risk with all WordPress plugins. Any one of them can break your site or stop working. While that’s true, WPCode is a special plugin. My site WP-Tweaks.com has so many custom snippets that it’ll take me a very long time to recreate them. WPCode allows you to export your snippets, but it’s not as if you can take the export file and easily recreate your code with all the formatting and line breaks.
My snippets are highly customized, and I can’t just download them from the WordPress plugin store. I’ll always have to ensure that I have an up-to-date copy of my snippets with me in case WPCode stops working.
My Solution – Use a Custom Plugin for Custom Code
Because of my fears, I prefer to use a specially created plugin for custom WordPress code. You get complete control over your custom code snippets by creating your own plugin. Even if your site breaks, you can easily access the file through your hosting file manager, delete the offending snippet, and your site will start working again. Because you create the custom plugin and inserted the code into the file yourself, you know where it is and what you did wrong.
Another benefit of using a custom plugin is that it’s just a single file. As awesome as the WPCode plugin is, it’s still a large plugin with many extra files and folders compared to just the single file necessary for your custom plugin. And there’s no need to update it or worry that a future update will break your site or cause your snippets to stop working.
For moderately advanced users, I suggest they stick to a custom plugin instead of using WPCode. But if you’re a beginner, WPCode will make things very easy for you. You can always switch to a custom plugin for code at a later date when you’re more comfortable with the inner workings of WordPress!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!
Leave a Reply