WordPress, as a platform, is very well coded. As a standalone platform it will run very well. However, one of the key benefits of using a platform like WordPress is the availability of plugins to easily enhance your website both aesthetically and functionally. There is a large WordPress plugin market some of which may not be coded as well. Installation of some of these plugins can have a detrimental effect on your website.
Even if you avoid excessive use of plugins, there’s still a lot of room for improvement when it comes to speeding up your WordPress site.
Here are a few ways (some well-known, some not) you can improve the performance of your WordPress sites:
#1: Choose A Good Web Host
Before you start thinking about optimising your WordPress site, you need to ensure that your hosting provider is not the root cause for your site being slow. Shared hosting platforms where 1000s of sites will be crammed onto a single server is the most common cause for slow and unresponsive sites. If your business is important to you, we would always recommend a dedicated server.
#2: Use A Fast Theme/Framework
Start with a fast and well-coded WordPress theme or framework. If you choose a theme packed with lots of additional features that you don’t need, it’ll negatively impact your site performance.
#3: Install A Caching Plugin
The second most effective way to improve your site’s load times is to install a caching plugin. As soon as you install a plugin like W3 Total Cache or WP Super Cache, you’ll be able to tell that your site loads faster.
In simple words, when a caching plugin is active on your site, it serves users cached copies of your pages. It greatly reduces MySQL database access, PHP requests, server access for static resources, and even HTTP requests.
We would recommend the W3 Total Cache plugin. It offers a variety of caching features such as:
- Page Cache
- Object Cache
- Database Cache
- Browser Cache
#4: Enable Gzip Compression
By serving compressed versions of your site to your visitors, they’ll be less in size and will generally load a lot faster.
The best option is to enable Gzip compression straight from your control panel. Otherwise, you can enable Gzip compression using a plugin like W3 Total Cache.
There are also a few tweaks that allow you to enable it from your .htaccess file. You can simply add this code to the beginning of your .htaccess file to enable server-level Gzip compression for a few known file types:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
#5: Try a CDN to Speed Up WordPress
By offloading the static resources of your site, like images, scripts, css files to a CDN service it can speed up your site. Not only those resources will load faster for visitors, if you use a CDN, your primary server will have less load to handle and thus will deliver significantly better performance while serving the rest of your site.
Cloudflare is one of the largest and well known CDN services available.
#6: Install Well-coded Plugins
There are 1000s of plugins available for WordPress. That doesn’t mean all of them are well-coded. You should always install plugins that are well optimized for the latest version of WordPress which don’t slow your site down. Read the reviews for the plugins before installing them.
The Plugin P3 (Plugin Performance Profiler) can be used observe the trends to know which plugins are really slow and troublesome for your site.
#7: Optimise Your Database
You can optimize your WordPress MySQL database directly from PHPMyAdmin, or by using a plugin like WP-Optimize or WP-DBManager.
These plugins are capable of deleting all your pending spam comments, trashed posts, auto-saved drafts, post revisions to name a few. They can also perform general MySQL database optimization queries without you having to access PHPMyAdmin.
A well optimized, fast responding database massively benefits a database-driven platform like WordPress.
#8: Optimise Uploaded Images
Images are one of the heavier elements most sites. There are however a few ways you can optimize your uploaded images. You should specify the maximum image dimensions for thumbnail, medium, and large sized images. That means, if you upload an image 1080px wide, and your content area is only 720px wide, normally the image will be scaled down using CSS. When you specify the maximum width of your ‘large’ images as 720px, it’ll then display the pre-resized, 720px wide image, which will be significantly smaller in size.
You should also look at reducing the sizes of your uploaded images without resizing them, or significantly reducing the image quality. Exporting at 90% has a large reduction in the final size but has a negligible impact on the overall quality.
#9: Replace PHP with HTML Wherever Possible in Your Code (Advanced Tip)
Pages written in HTML are a lot faster to process for web servers than PHP. If you have experience in both PHP and HTML, you can replace a few instances of PHP in your site’s code (in themes or plugins) with plain HTML.
#10: Use CSS Sprites
Theme images (where possible) should be combined into as few images as possible, using CSS sprites. This how the social_icons.png for the social media icons on your site may look like.
The browser gets unique portions of it as individual images using CSS positioning, and loads them on the page in the desired position. This single image saves 13 HTTP requests.
Slow load times don’t only create a bad impression about your site to your visitors, it’s also bad for your SEO. You can monitor the current load times of your site by performing Pingdom’s Site Speed Test. You can also find useful information about your site’s current performance and areas in which it can improve by testing your site in Google PageSpeed Insights.