How to minify files in WordPress

If you’ve spent much time trying to speed up your website, you’ve probably come across the term “minify” — but you may not know what it means or how to do it. In this guide, we’ll show how to minify your code to help your site run faster and get better speed test results.

What does minifying mean?

Minifying is the process of removing any extra characters from code, such as line breaks or extra spaces, to reduce the size of the file as much as possible. Depending on how code is written, minifying it can potentially reduce its size by as much as 20-30%. It may not sound like much, but any chance you have to speed up your site helps. HTML, CSS, and JavaScript can all see file size reduction from minifying.

How do you minify code in WordPress?

If you use WordPress, you haven’t written all the code for your site yourself. In fact, many WordPress users don’t know how to write code at all. So how can you minify code you haven’t written? Thankfully you can use a plugin to help. Many themes have minify tools built into them, so check first to see if your theme offers this ability and only use a plugin if it doesn’t.

If you need to use a plugin to minify your code, install the Better WordPress Minify plugin. If you’re unsure how to install a plugin, begin with our “How to install a plugin” tutorial. Once the plugin is installed, you’ll see a new option on the left side of your WordPress Dashboard, “BWP Minify.” Click on it to change the Better WordPress Minify plugin settings. Check the top two boxes, “Minify JS files automatically?” and “Minify CSS files automatically?” to minify your JavaScript and CSS files.

Once you’ve completed this process, your JavaScript and CSS files will be combined and minified. Hopefully, you’ll see your speed test results increase along with it!

Comments