Often in articles regarding plugins and their impact on websites I see the advice to implement code instead of using a plugin. That sounds great; however, there are some things to be aware of when adding code instead of a plugin.
Security and Updates
Most people don’t code and rely on copying and pasting code they find on the web. This code may not be current or error free. Plugins from WordPress.org must stand the test of many users and errors are reported quickly. Update records and WP version compatibility are also recorded. Copy paste code found on websites rarely provides this information.
If you are adding code manually then you are responsible for updating it. You are also responsible for security. Widely used scripts as we saw with Tim Thumb can be targets for hackers. Old code and scripts make a site vulnerable.
The experts at WP Beginner think so too:
If you choose a plugin, then you can benefit from future updates which may improve performance, fix bug, or patch security vulnerability. WP Beginner
Their excellent article addresses concerns and myths that have grown up around plugins. The article clearly states the pros and cons of plugins vs code.
WordPress Plugin vs Functions.php file (Which is better?)
Speed and Performance
A number one concern regarding plugins is how they will affect the speed and performance of a website. I found this statement concerning speed reassuring:
In terms of performance, it does not matter where the code runs. Adding code snippets to your functions.php file will have the exact same impact on performance, that a WordPress plugin with the same code would have otherwise. WP Beginner
Plugins that come bundled with tons of features and seem like a good deal because you are only adding one plugin, but there is often a price to pay in speed and performance for all those loading features. I look for plugins that are light-weight and use specific. Running more plugins that meet that criteria than using a mega plugin that loads lots of features I don’t need has produced better results for the sites I build and maintain.
When to Use a Code Snippet
Are there times to use a code snippet instead of plugin? Again, more good advice from WP Beginner:
If the functionality you are trying to add is not available as a plugin and the code snippet is really simple, then you can add it to your theme’s functions file.
Another possible scenario is when you are adding functionality that is related to your WordPress theme or child theme. For example, creating new image sizes, showing dates, adding custom code before or after content, and more. WP Beginner
For me the peace of mind I get from using quality plugins is worth a lot. I am forever grateful to the contributors to the WordPress plugin repository and the developers of high quality premium plugins for the plugins that make WordPress “magic”.
Leave a Reply