Article by WHSR Guest
This article was written by a guest contributor. The author's views below are entirely his or her own and may not reflect the views of WHSR.
The Internet abounds with articles that will tell you how to optimize the performance of your WordPress site. I’ve written some of them myself. If they’re any good, after reading you’ll have a clear idea of the best practices for improving the performance of a WordPress site. But, “best practice” is more or less a code phrase for “if you can’t or won’t learn how to understand this subject in depth, by doing this you’ll probably make things better.” Best practices are very general, and although implementing them will help, it’s unlikely to produce the best possible results in every case — and that’s what optimization is all about: figuring out how to achieve the optimal outcome in specific circumstances.
Every WordPress site is a unique combination of themes, plugins, and tweaks, each of which can affect performance. The only way to truly optimize a WordPress site is to know precisely which aspects are causing performance issues and focus your efforts there. There’s very little point spending money and time setting up an international content distribution network if 98% of your local business site’s visitors live within 100 miles of the server; perhaps your time would be more fruitfully spent sorting out the social sharing widget causing multi-second delays loading your homepage.
To know where your efforts are best placed, you need data. In the rest of this article, I’m going to highlight some tools you can use to profile a site and gain insight into what is influencing performance.
Google Pagespeed Insights for WordPress is a plugin that takes PageSpeed data and uses it to create a dashboard that will help site owners target their optimization efforts.
Most site owners will already be familiar with this one, but it’s worth mentioning because it’s very useful. There is some crossover in functionality with PageSpeed Insights, but if you’re a visual thinker, you’ll find that the waterfall representation will give you a clear insight into the page-load process, making it easy to spot the causes of latency.
If you really want to know the nitty-gritty details of your site’s performance, the Slow Actions addition to the Debug Bar plugin will give you all the information you need.
The plugin will display the 100 slowest actions that go into building a WordPress page. This information is more useful to developers than the average WordPress user, but if you’re intent on learning what you need to know to properly optimize your site, this plugin is irreplaceable.
At the top of this article I said “best practices” aren’t always the best for specific sites. That’s because some optimization advice is irrelevant for some sites. To combat that I advise that you gather as much information about your site as possible, but too much information can be as dangerous as too little if you don’t prioritize properly.
Keep in mind that even if these tools tell you “Factor X” is making your site slower than it could be, that only matters if it has a tangible effect on user experience or conversions — even Google’s homepage fails some of its PageSpeed Insight tests. A law of diminishing returns operates here. Sometimes fast is fast enough, and more optimization is just wasted time. Use these tools, but make sure you put the information they provide in the context of your wider goals.
Hopefully I’ve made it clear in this article that obsessive optimization is often not the best use of resources. There are however, a number of optimizations that will result in better performance for almost any WordPress site.
Cheap hosting might be tempting, but there’s a reason it’s cheap. Low-cost shared hosting providers tend to over-sell their plans. There will be more sites on a server than it can reasonably handle, especially if a few of them get traffic spikes at the same time. If your hosting is slow, nothing else you do is likely to benefit your site as much as it could.
WordPress is a dynamic site generator. It takes a mess of PHP code and database queries and cobbles them together into the HTML that makes up a webpage. No matter how whizz-bang fast your hosting is, dynamic page generation is slower than serving static pages. We use dynamic site generators because they come with lots of other benefits – not many of us would be happy coding our sites from scratch – but most of the time we don’t need to have pages generated for each visitor: they don’t change that quickly. Caching lets us save generated pages on disk or in memory, which makes them almost as fast as a static page.
Once you’ve got good hosting, caching, and asynchronous loading in place, it’s time to think about using a content distribution network. After that, your optimization tweaks will start to fall into the realm we discussed earlier, and it’s time to give serious thought to whether you’re over-optimizing and if your time might be better spent on conversion rate optimization or writing great content.