Recently I was commissioned to optimise a WordPress site on behalf of an SEO agency. This usually consists of reports from Google’s pagespeed insights and there’s a number of things you can do to increase the speed.
Before you start you should first check that the foundations are correct.
For example all JS and CSS files are properly enqueued in WordPress we will later need to work on minifying and combining these into one file.
Ensure important page elements are near the top, move your html around if required and ensure that your CSS files are ordered in the way the page loads you might want to break the css up into two files. The first loading important structure e.g header, body content etc.. The second appearing in the footer loading the remaining part of the site.
Onto the optimisation
The next thing you want to look at is image optimisation there’s a plugin you can install that optimises all image uploads as you upload them which in turn utilises some command line tools to compress images e.g optipng and jpegoptim. You also need to run these tools on the existing image library.
Set an expiry on assets through nginx or apache or alternatively just use Cloudflare or any CDN of your choice.
HTML Minify https://github.com/cferdinandi/html-minify does a decent job of minimising your html.
You then need to install a plugin to combine your css/js and again work on the order here to ensure the right delivery.
Fonts are often blocking resources, consider using Google’s Font API instead and anything else that isn’t critical either defer or move to the bottom of the page.
A lot of the above can also be achieved in part of in full by Google’s pagespeed module you’ll achieve better results though by doing each part onsite.
If you have any scripts that work with images e.g sizing images on the fly or creating thumbnails and have a very large amount of images either through the creation of different sizes or in total watch out for anything that reads the folder they are contained in as this can put a serious performance hit on your server.