How to Minify Your WordPress Files
As you add more tools and content to your site, the number of files will expand, leading to slower loading times. Speed matters on the internet, so a slow-loading site can be a big problem.
What is Minification?
Every second counts on the internet. As websites become more optimized, many people have been primed to expect fast loading times. In fact, almost half of all internet users expect sites to load in two seconds or less.
When a single-second delay can result in a seven percent reduction in conversions, being stuck with a slow site can be a death sentence. Fortunately, there are remedies to help you speed up your site, including minification.
This minification process may sound overly technical on the surface, but it’s very straightforward. It simply involves removing unnecessary characters from the code.
Let’s look at an example. Here’s what a normal CSS snippet might look like:
If you were to minify this code, the result might end up looking like this:
All of the required information is still there, but the line breaks, spaces, and some other characters have been removed. These elements are not necessary for a computer to understand the code and only exist to make it more readable to humans.
It may not seem like this minor change would have a big effect, but think about how many lines of code you have running under your site’s hood. Minification can significantly cut down the size of each file, which will, in turn, make your site load faster. This is especially true if your site contains a large number of files, scripts, and plugins.
We’re now going to look at two methods you can use to minify code, both manually and with a dedicated plugin.
Get Content Delivered Straight to Your Inbox
Subscribe to our blog and receive great content just like this delivered straight to your inbox.
Fortunately, the tools will all work in the same way. For example, using Clean CSS, you’ll just need to paste your original code into the relevant field and click on CSS Minify. You’ll see the results in the other field, which you can then copy and paste into your site:
We recommend saving both versions of the code. Otherwise, you risk losing the original code. The original will be easier to troubleshoot and edit than the minified version.
Additionally, we recommend that you only use manual minification if you are confident in your coding abilities. If you don’t have a lot of experience, you might want to use a WordPress minification plugin instead.
2 Plugins to Help Minify Your WordPress Files
1. Fast Velocity Minify
- Requires minimal configuration and runs automatically in real-time
- Offers extensive options for advanced users
- Provides great results and reliable support
Pricing: Fast Velocity Minify is open-source and completely free.
Autoptimize is one of the more popular minification plugins (and for good reason). It will bundle your files together, optimize them, and cache them to create as few requests to the site as possible. While it does offer some additional options, this plugin is ideal for those who want a ‘set and forget’ approach to minification.
- Easy for beginners to grasp
- Additional options for more optimized performance
- Advanced customization using the dedicated API
Pricing: The Autoptimize plugin is free, although the developers also provide premium configuration services including personal installation and optimization tailored to your site.
How to Minify WordPress Files With a Plugin
Now that you’re familiar with the tools available, you can start minifying your WordPress files. For this tutorial, we’ll be using the Fast Velocity Minify plugin. This is because it’s easy to implement for beginners, while still offering a great deal of optional configuration for advanced users.
Once you’ve installed and activated the plugin, you don’t need to do anything else — your site is now ready for minification.
The next time somebody visits your site, the plugin will intercept your files and create a copy of them. It will then group the files and minify their coding to cut down on the number of requests. These optimized files are saved in the cache and used whenever the site is accessed again. This means your original files will be unaffected.
If you’re a more experienced user, the plugin does offer some advanced settings. You can access them by going to Settings > Fast Velocity Minify within WordPress:
Among other options, you can disable minification for certain files, exclude specific assets from the process, and determine the cache’s location. You can also purge any minified files and allow code processing on specific query strings:
Minify Your WordPress Files Today
Minifying your WordPress files is a quick and simple way to improve your site’s performance.
This way, you can make sure that you don’t lose visitors due to long loading times.
Do More with DreamPress
DreamPress Plus and Pro users get access to Jetpack Professional (and 200+ premium themes) at no added cost!