Not one developer who is active in the WordPress community lives a day without reading and hearing remarks from WordPress users and web developers who heard from a friend who heard it from a friend who got it on good authority that “Plugins are bad. They make WordPress slow”.
These are the same wannabe WordPress developers — non developer users are let off the hook here — who say “add code to the theme’s functions.php file but don’t use a plugin”. And they say it with the same oratory skill and emotion as an evangelist preacher telling his congregation of the upcoming apocalypse.
WordPress is designed to be easy to use and easy to customize. The WordPress core code is sprinkled with hooks and filters to allow new and seasoned developers to alter the output of WordPress code.
Plugins are bad for WordPress?
Here is some news for those ‘plugins are bad’ developers: functions.php is a plugin. Any code added to functions.php works exactly the way it would if it were added to a regular plugin file. There is one difference: functions.php is loaded with the theme and the theme loads after the plugins.
The idea that plugins inevitably make sites slow to load is fallacious and harmful to WordPress users, especially to new users of WordPress who are already trying to navigate the well intentioned myths about SEO and content organization.
What is a WordPress plugin?
WordPress plugins add features, remove features or alter features of the standard WordPress CMS. Plugins use the WordPress Application Program interface — the WordPress API — to hook into the code hooks and filters that are written into the core WordPress code.
- Hooks are used to inject code at specific points of WordPress core code output. For example, to place social media icons below post content.
- Filters are used to adjust WordPress core code output. For example, to change the HTML markup used by the post title.
Hooks and filters are useful tools. They are what make WordPress adaptable to meet the unique feature needs of different websites. They make WordPress customizable.
Hooks and filters are not limited to the WordPress core code:
- Plugin developers can provide hooks and filters within their plugins to enable developers to alter the output of plugin code
- Theme frameworks provide hooks and filters that empower theme developers with tools needed to build custom themes.
Hooks and filters are power tools that exist for good reason: they simplify customization of WordPress sites.
But, but, but thousands of lines of code…
Not all plugins use thousands of lines of code. Some plugins use a single line that could easily be added to functions.php. When plugin code is short enough to go into functions.php then that is probably where it should go unless there is genuine need to load the code outside of the theme or before the theme loads.
What about plugin load order?
The normal boot order for WordPress plugin code is:
- active network enabled plugins
- active regular plugins, then
- functions.php (in the theme)
The hooks and filters that plugins ‘plug into’ load in their own specific order. The order of loading is controlled by WordPress core. The WordPress boot order is shown here.
The order in which plugins load is not necessarily important because the WordPress hooks and filters tapped into by plugins and code snippets are loaded in an order dictated by WordPress core.
But what about plugins that use a ton of code?
Plugins that provide features that require lots of code us lots of code because.. they require lots of code. There is no way around that in many cases. Lots of code does not necessarily equate to slow or sluggish website page load times. Developers can use file caches and transient options stored in the WordPress database to help minimize any negative impact on page load times caused by their plugins.
Some plugins do slow WordPress down but not necessarily does this make a plugin bad or unusable. Always consider whether the feature added by a plugin is beneficial or essential to the site.
Not all files used by a plugin are loaded each time a page is viewed.
- Security plugins can affect page load times slightly but security is essential to keep a site safe. The slowdown might only affect particular parts of the site and only particular users.
- A reputable shopping cart plugin could marginally increase page load times. An online store without a shopping cart plugin would be a useless ecommerce store, wouldn’t it?
- An SEO plugin will increase page load times within the dashboard but without the SEO plugin a site could struggle to rank well. The perception of frontend loading times by anonymous users should be unaffected by the presence of an SEO plugin.
- A cache plugin will initially slow down a site. The first time a page loads is slower than its successive page loads. The page has to be cached before a cached page can be loaded. Some cache plugins have auto-cache engines that cache silently ahead of pages being visited.
Remember when people said “Don’t use Jetpack because it’s bloated”?
Jetpack contains thousands of files. The files that are used are only those files needed for the active Jetpack plugin modules to work and some of the files are for code that is only loaded when the WordPress dashboard is visited by an admin users.
Not all plugins affect the frontend of the website. Any slowdown caused by a plugin might affect logged in admin users or editors only. Test when and where slowdown occurs.
The argument that ‘plugins make sites slow’ is irrelevant to most WordPress sites where features added by plugins are necessary to enable sites to do what the sites are supposed to do.
We can write our own plugins that do the same as readily available, tried and tested plugins or we can use plugins that are regularly maintained by developers and that are trusted by the WordPress community.
Use as few or as many plugins as your site needs. Use reputable plugins. Consolidate plugin features where possible. Make use of functions.php for small simple code snippets. Write your own plugins if you prefer. But don’t be afraid to use a plugin because someone says “Plugins slow sites down”. WordPress is designed to use plugins. Sometimes a little slowdown is inevitable when a plugin adds needed complex features to a site, but would you prefer to not have the feature?
The next time someone says “Don’t use plugins because they will make your website sluggish.” Show them this article and I’ll put ’em straight for you.