When working at the speed of a website, try to save milliseconds from everything possible. This is why I recommend you to minify your WordPress site files.
Getting a fast and performing site is a complex activity made up of many practices. First you have to choose a top quality hosting.
Then you will have to optimize your images, even using more advanced techniques such as lazy loading.
You will also need to carefully choose the plugins you use and not overdo the installations, always evaluating if the functionality you are looking for is not already available within the native WordPress functions.
We can therefore say that, to speed up WordPress, we must make sure to eliminate all the superfluous, and avoid unnecessary data being downloaded.
Minify WordPress files allows you to get rid of some unnecessary data. Let’s see what it is.
What does it mean to minify files
When a programmer develops code, he must necessarily keep his files in order in order to understand what function each part of the file performs and to avoid making mistakes that compromise its functioning.
For this reason, the files will be full of spaces, carriage returns, indentations and comments.
All these elements are not necessary for the program to work properly. And here we can try to minify WordPress files.
By eliminating spaces, comments, empty lines, the size of the files will be reduced, without compromising in any way the correct functioning of the plugin or function. This is usually a few kilobytes, but if your site contains a lot of files, you may notice some difference in performance.
Also, the browser will interpret the code faster, as it will no longer encounter strings which then have to be ignored.
File compression alone will certainly not make your site lightning fast but, used in conjunction with all the other optimization practices, it will do its part.
Let’s take a CSS file for example. Here’s what it will look like as it is released by the developer.
If we apply minification, the result will be very different. As you can see, you will get a “wall” of code, much more difficult for humans to interpret, but much simpler for a machine.
According to a Google test, optimizing your files this way could save you as much as 63% of the file size by turning a 406-character code into just 150.
How do you minify a WordPress
Are you wondering if you will now have to go and delete all spaces and comments within WordPress files? Don’t worry, you won’t have to do anything like this!
If you use a plugin like WP Rocket or W3 Total Cache, you can take advantage of their features.
Make sure all three are active.
If you use W3 Total Cache instead, enter the section Performance> Minify. Check the box Enable to the voices HTML minify settings, JS minify settings, CSS minify settings.
In the HTML section, you can also minify the inline JS and CSS codes, i.e. those that appear directly within the HTML and not on external files.
For all three items, you can choose to also delete the carriage returns (Line break removal).
If there are any files or pages that you prefer to keep with the extended code, specify their path (relative, that is, without within the section Advanced.
Minify the codes manually
While this will probably never happen to you in your entire life, it may be complicated or impossible to minify your files using such a plugin, for example, if they are part of other domains.
In this case, you could manually compress your files and upload them directly to the already optimized web space.
There are online services such as Minify Code which allows you to paste a code and get it fully minified.
The instrument HTML Compressor it also allows you to directly upload the file and download it already optimized.
Did you already know the ability to minify WordPress files?
Do you know of other tools that can help you do this?
All clear? If you have any questions, as always, leave us a comment below.