One of the most popular talking points in the WordPress community is speeding up WordPress and optimizing web pages. I don't think there is a WordPress blog without an "X Tips to Speed Up WordPress" article. Don't get me wrong, it's a good thing. But we need better articles about this topic instead of dull plugin round-ups.
This may look like yet another "tips for speeding up WordPress" tutorial, but in this three-part series, we're going to go through every aspect of optimizing and speeding up your WordPress website.
Let's start with the most popular and probably the easiest thing: caching.
I think it's safe to say that this is the most popular topic when it comes to speeding up WordPress. Granted, this is because of the popular and easy-to-use WordPress caching plugins, but it's also one of the fundamental techniques of reducing database load and speeding up WordPress websites.
We're going to get back to caching plugins, but let's look at the two types of caching: server-side caching and client-side caching.
By fine-tuning the
.htaccess file, I mean adding the "Expires" header in it. You might have heard the term "leveraging browser caching" because it's commonly used in "website optimization" tutorials, and it's a high-priority criterion in the Google PageSpeed service.
Luckily, we don't have to come up with these headers ourselves—there's plenty of code ready to be "borrowed" on the web. I like the one in the HTML5 Boilerplate, where the headers are divided by categories of file types:
Place these lines of code in your
.htaccess file and you're good to go!
When it comes to server-side caching in WordPress, we can talk about four major kinds of caching: page caching, database caching, object caching, and opcode (operation code) caching. Sourav Kundu explains this in his article at WP Explorer, but let's recap:
Our main chapters are the aspects of speeding up WordPress, so it might be off‑topic to review plugins. Nevertheless, it's a good idea to talk about a couple of plugins in each chapter. As for caching, I know you already know the two most popular plugins:
Databases are the "brains" of your website: They store the valuable data that you show on your pages. Static HTML websites store their data inside the pages, but content management systems have to rely on databases (SQL, NoSQL, XML, JSON and such) to store our data. WordPress is no different—it uses MySQL to store the static and dynamic content along with your website information, WordPress settings, user details and so on.
Databases are a powerful standard to keep, serve and alter your data, but if you use them wrong and forget to maintain them, they can get fat and bloated. And like any other software, WordPress needs maintenance, too. WordPress doesn't build up too much bloat in the database, but that doesn't mean it won't slow down your website.
You need to keep an eye on your post revisions, trashes of posts, pages, comments, etc., and any other kind of "stale" data. And every now and then, you must check your "database overhead", which is often compared to hard disk defragmentation or changing the oil of your car.
It's possible to maintain all of these manually: You can empty your trash, disable the "revisions" feature, delete spam comments and optimize the database overhead by logging in to phpMyAdmin, but that's not an optimized technique for database optimization. Instead, you can use a WordPress plugin to do all the work.
There are more than a few plugins that allow you to optimize your database with one click or even automatically. The one I like the most is WP-Optimize: It automatically cleans up and optimizes your database without any hassle.
WP-Optimize lists its main features as follows:
Be sure to check out other database optimization plugins, but don't be negligent about maintaining your database.
In the next part of the series, we'll be looking at the aspects of compression and minification, and using CDNs to make your WordPress website faster.
What do you think about speeding up WordPress? Share your thoughts below in the comments section. And if you liked the article, don't forget to share it.