One of the great things about WordPress, and a major reason for the platform’s huge popularity, is its extendable design. No matter what kind of functionality you need for your WordPress site, as long as WP itself supports it, there is a plugin for it out there. However, this is a double-edged sword – carelessly extending your site with multiple plugins can eventually drag down its performance significantly. And combined with an already heavy/unoptimized theme, this can lead to a situation where your site is practically unusable on low-end machines.
This can affect you in various negative ways, including even penalties from search engines which test your site for its loading speed and overall performance. Let’s have a look at some of the common performance sinks and what you can do to avoid falling for those traps.
- Compress your images
This is easily one of the biggest improvements most people could make to their WordPress sites. Spending just a few seconds to pick an appropriate format for each picture you upload and compressing it down a little bit can have a tremendous impact on the way your site loads, especially if it’s heavy in images in general. Optimised hosting plans for WordPress typically tend to address this issue from the outset.
For anything hosted inline, you should keep images at a 640×480 resolution or lower, and even that’s pushing it for most pictures you will be showing along your text. For things that should be viewed fullscreen, you can preserve the original resolution, but you can still save some bandwidth by displaying a preview in a lightbox, and only showing the full-sized picture if the user clicks on it again.
JPEG should be your choice by default, and you can safely turn up the compression to at least 30-40% on most types of images without a visible quality loss. This is great for photographs, drawings, and other detailed images with lots of varied shapes and colors. On the other hand, anything featuring lots of straight lines and large flat-colored areas would probably look better in PNG. PNG is also your only option if you want transparency (with a good quality, at least – while GIF supports it too, it has a more limited color palette).
- Optimize your JavaScript
Another common mistake is to include lots of JavaScript libraries for no good reason, especially if you don’t use their minified versions. Do you really need jQuery when you’re only using it for a few simplified selectors? Did you forget to replace a library with its minified version before finalizing the design of your page? These things can add up a lot. Even if the scripts are small in size, they may still run various methods that slow down the page unnecessarily when it’s loaded.
Also, it may not always be faster to host these libraries on your own server if they have public inclusion links available. In many cases, the library will be hosted on a specialized high-speed server that will be able to serve it much faster than your own, and this can also take some load off your host and improve the overall performance of your site.
- Use a Content Delivery Network (CDN) for larger sites
A CDN is not something every user needs, but it can speed things up a lot on larger, content-heavy sites, and there’s a good reason that companies like Facebook and Twitter rely on CDNs heavily in their infrastructure. Put simply, a CDN is a network of content servers that host larger media files like images and videos, as well as smaller but commonly requested ones like scripts and style sheets, and whenever a user requests one of those resources, the CDN picks a server closest to that user to deliver it from. This can significantly improve the loading speed of your site, but it also comes at an appropriate cost and it’s not typically something you would think about until your site grows in size a lot.
Still, it’s definitely a good idea to familiarize yourself with the offers provided by the various popular CDN networks on the market if you’re planning to make your site big. Even medium-sized sites can benefit quite a lot from offloading some of their content to a CDN, and there is a lot of competition on this market today, meaning a good number of good offers.