Lately, I’ve been posting some rather technical articles but today I would like to talk about a few tricks I’ve learned over the years to speed up a WordPress site. Most of the work involved is done on WordPress itself and very little time is used tweaking the server.
These tips will help you speed up your site but it will also reduce the resources needed and you’ll be able to serve more clients than before without crashing your server!
Less is more
The idea here is to reduce as much as you can the number of HTTP requests performed by the browser and adhere to the KISS principle
You should start by putting your javascript in a single file and minify that file, you should do the same with your style sheets, you can use a WordPress plugin which will make things easier on you or you can do it manually, it’s up to you.
The next step would be to disable some plugins, this won't be easy but you must make an effort and leave only what you really really need, some times there are better ways to accomplish things without the need for some fancy plugin that slows down your WordPress.
Another point for optimization is your theme, you need to keep it clean and simple if you need to use a lot of images using CSS sprites.
Cache, cache and cache
One of the problems of PHP is that it’s an interpreted language which means that the server has to read and interpret the source code into something a machine can understand ( opcode ) for every requested page, you can imagine how time and resource consuming that can be. There are two things you can do to get around that.
- You should serve static HTML instead of processing the comparatively heavier and more expensive WordPress PHP scripts whenever possible, there are a number of plugins available and I’m sure you’ve heard or even tried a few like WP-Cache and WP Super Cache but I think that the plugin Hyper Cache performs better than the others.
- There are times when you can’t serve static HTML and your server will have to interpret PHP scripts but you can use an opcode cache such as APC or XCache
We have dealt with apache and PHP but there’s one more to go and that’s optimizing your database queries. Instead of running the same query over and over again, we can take advantage of a plugin like DB cache Reloaded and store the results for later use.
That’s it for now, don’t be shy and tell us your experiences and results.
Streamline CORS for your APIs on AWS Gateway with Terraform and Lambda secure scale done
Cut your Kubernetes cloud bill with these 5 hacks for smarter scaling and resource tuning
PostgreSQL blends relational and NoSQL for modern app needs