This document contains outdated information.
I’ve revisited this topic recently, containing more relevant and up-to-date information aligning with the new specifications provided by Pingdom and Pagespeed Insights. If you’re looking for an up-to-date, quick and easy way to achieve a 100/100 on Pagespeed Insights and Pingdom. I suggest you follow that link.
When you’ve reached this point of this post, it might be because you haven’t still reached that perfect score on Google Pagespeed Insights or Pingdom. This can be because of very site specific issues.
That’s why I made a list of anything I ever ran into while optimizing a WordPress website. You might never make it to that perfect score, because your site is simply too dynamic. But only after you tried everything in the list below, you’ll know you did everything you could.
The Wait is Over!
Pro-tips for Optimizing your WordPress website
Leverage Browser Caching: Host ga.js or analytics.js Locally
There’s a good chance you’re using Google Analytics to keep an eye on your website’s traffic. If so, then there’s no doubt you’re still getting the leverage browser caching suggestion from Google Pagespeed Insights and Pingdom. This sucks! Why would Google have Pagespeed Insights and set the caching rules of its own scripts to only 2 hours?
Appearantly they tweak the analytics script a lot. Almost daily. So it’s necessary that a browser grabs the latest version at all times. Understandable. But 2 hours!?
Thanks to yours truly, the WordPress Plug-ins catalogue now offers the perfect solution. Host ga.js or analytics.js locally (on your server) and update the script using a custom PHP-script and run that cronjob at a certain interval. [ Click the link. I promise it’ll be worth it. I won’t tell anyone. ]
Just like with the previous pro-tip, Google is the hero and the villain here as well. If you’re using Google’s (or any other) webfonts, you will still be getting the eliminate render-blocking in above-the-fold content suggestion from Google Pagespeed. Pingdom might tell you to leverage browser cache and to combine external CSS. There’s a lot of ground to win with this one, yet the sollution is so simple.
As with the Analytics-script, webfonts can be saved locally as well. You just need to download it, generate a webfont and adjust your CSS accordingly. You can find guides on how to do this in every corner of the web. To make it even easier for you, I’ve created a plugin which will automate hosting Google Fonts locally.
I would recommend this to anyone, because I don’t think anyone uses this feature in WordPress. Yet it is hard-coded in WordPress and can’t be disabled from within the settings.
wp-emoji.js is a script that can’t be aggregated by Autoptimize or any other minify plugin, which will always result in an extra DNS request and render-blocking content. Luckily this script can be easily disabled. Again, I would recommend this to every WordPress-site.
Reduce Server Response Time: Use Alternative PHP Cache
If you own a VPS or Dedicated Server, you should always have APC enabled. In some cases (such as mine) shared hosts also support APC. Enabling APC from within your servers administration panel (usually cPanel or DirectAdmin) will greatly reduce your server‘s response time. A guide on how to enable APC on a Shared Hosting package (if your host supports it) is coming soon…
Reduce Server Response Time: Use the latest PHP version
Recently PHP 7.0 was released to the public. Most hosts have silently upgraded your hosting package to support it as well. Version 5.6 is still the most widely supported version, but if your WordPress installation allows it, I greatly recommend you upgrade to version 7.0. It might reduce your server‘s response time with about 0.5 seconds. Look around in your hosts admin-panel and/or look into your admin-panel’s documentation. Before switching to PHP 7+, make sure your WordPress theme and plugins support PHP 7+.