Let’s face it: WordPress is not the most svelte of content management systems. But as we all know, it gets the job done.
And it’s not THAT slow, really. It’s just that it’s really easy to drag it down, especially in light of all the nifty bells and whistles you can throw in.
There are scores of ways to speed up WordPress, but many of them are highly situation-dependent. I want to focus on just the top 5 tweaks that will speed up WordPress page loads for EVERYBODY.
Every time WordPress loads a page, it looks up the base URL of the website in the database. If I didn’t know WordPress so well, I’d be saying, “Are you fscking kidding me?”
But that means we can save a couple of database lookups, easy. Let’s add the following lines to the wp-config.php file:
How much this tweak speeds up your page loads will depend on the configuration of your server and database and what kind of strain they are commonly under. Dreamhost shared-host customers often see the greatest benefit here. (No offense, Dreamhost! You guys are great. Don’t kill my accounts. haha)
Use a Caching Plugin
This one trick can improve your page load time significantly (by how much will depend on your hosting provider), because it essentially lets the WordPress engine be a slacker: when a query comes in that exactly matches a page load already completed for a previous website viewer, the caching plugin will serve up a saved, static page instead of a dynamically generated page.
Use of a caching plugin is also the #1 way to prevent site overloads during heavy bursts of traffic (we used to call it “getting slashdotted” back in the day).
Cut Back on Dynamic Page Elements
Pop Quiz, hotshot! Which do you think loads faster?
<?php bloginfo(name); ?><?php bloginfo(description); ?>
<title>The WordPress Consultant</title>
I hope you guessed the second one.
This tip regards the coding (or choice) of WordPress themes: wherever possible, replace dynamic lookups with static displays.
Do you really need to be able to set all of your META keywords in an admin interface in the WordPress Dashboard? If you think you do, consider that each one of those configurable elements kills another baby CPU cycle. Think of the child processes!!
(I realize that many webmasters concerned about optimizing page titles for SEO purposes will want to dynamically set their title tags, so the above example was chosen for ease of illustration, and also to encourage tedious pedantry in the comments.)
Each time WordPress loads, it spins up each and every plugin marked as Activated in the Dashboard. If you have lots of fun “might use it someday” kinds of things hanging out in there — or worse, plugins you used to use but have let languish in obscurity — then it’s time for some spring cleaning.
Go through the list and Deactivate and/or Delete all the plugins you don’t use. You may be surprised at how well your site runs after this. Many older websites frequently see “gremlins” (unexplainable system behavior) disappearing after getting rid of unused plugins.
Look, it’s time for a little self-honesty. You’re never going to do a podcast. Or at least, you’re not going to do one this week, and having that plugin turned on is making your website LESS AWESOME. De-activate PodPress and get on with your life.
Work the Kinks Out of Your Database
You might be able to speed up your database queries by eliminating crufty old tables and bits of data no longer relevant to your interests. Get phpMyAdmin, which is not a WordPress tool per se, but can be used to “Repair” and “Optimize” your WordPress database. You can also use it to scan for tables related to plugins you no longer use so that you can delete them.
My Secret To-Do List
This is it! The above are the 5 operations I go through on every single WordPress site I install, fix, upgrade, and maintain.
According to Matt Mullenweg at WordCamp 2011 just this weekend, roughly 22% of new domains this past year were set up with WordPress on them (I think I was responsible for like 1% of them). You can help make the web faster by implementing the above 5 tricks to speed up WordPress.