24 Things I Do As A Developer to Make WordPress Sites Faster
Faster WordPress websites will lead to satisfied users, impressed search engines (improving rankings), and will ultimately get you more business. Here are 24 things I do to make WordPress websites faster (contains beginner to advanced methods).
Watch my video or read ahead below!
1: Compress Images
Use TinyPng.com to compress images which will significantly reduce the file size. Smaller images lead to less data your web browser has to download.
TinyPng reduces file size by "selectively decreasing the number of colors in the image". It's incredibly effective. My total savings is 71%, and the image quality difference is noticeable.
Their website offers a free service for up to 20 images, but it's best to use their WordPress plugin to ensure all images are compressed, even as new ones are uploaded. This plugin compresses images for free until you hit a certain number of images, and then the plugin costs money.
I always compress images before uploading them to a website, as it significantly reduces the file size.
Cloudflare also offers a lossy compression service that is worth looking into.
2: Resize Images
Resizing differs from compressing as the resize changes the dimensions of the image. To make your WordPress site faster, find large images and resize them. The largest image on your website is usually 1920px wide and 1080px tall. Images that exceed these dimensions are likely too large and need to be scaled down. TinyPng, as mentioned in the previous point, can also resize your images.
3: Serve Images in Next-Gen Formats
Check out the WebP image format. It is a replacement for PNG and JPG. This format provides greater than a 20% reduction in file size. There are WordPress plugins that automatically handle this for you.
4: Use a CDN
A Content Delivery Network (CDN) is a network of servers that stores copies of your website, enabling faster website delivery.
CDNs make your WordPress site faster for two reasons:
- The stored copy (cache) of your website is faster than the original source
- Visitors connect to the closest server to them rather than going to the original server
I recommend using Cloudflare as they offer a free and top-tier CDN while providing many other features to make WordPress sites faster.
5: Use Cloudflare Plugin
Cloudflare offers an incredibly easy to implement and highly effective plugin with optimizations built specifically for WordPress. This plugin is possibly the most impactful single thing you can do to make your WordPress site faster. The service costs about $20/month and is well worth it. With one-click installation, automatic platform optimizations, and many other benefits, this service is a slam dunk.
They even give you stats on how many page views were served by Cloudflare vs your server.
Ensure you configure Cloudflare correctly for WordPress.
6: Use Varnish Cache
Varnish Cache quickly accelerates the speed of websites. This software gets installed on your server and will make content-heavy websites faster. Pantheon.io offers this built-in and without any need for configuration - I highly recommend checking them out.
7: Use Redis or Memcache
These services are a type of cache that essentially stores your slow database in high-speed memory. Redis and Memcache, also known as object cache, will significantly improve the speed of your website, especially content-heavy ones. These services are free but require technical knowledge to install on your server. Pantheon.io offers this on their medium hosting tier. That is my primary way of using it, although I have done custom implementations before.
8: Minify JavaScript
Imagine a paragraph
that is
split up like this. But
times 10,000.
That's how code is written. Unlike sentences, code is not human readable when it's all on one line, so when writing it, we use a lot of spaces and line breaks to make it easier to comprehend. Well formatted code is much easier for us human developers to read, but it's slower to be interpreted by your web browser.
JavaScript is in fact, the slowest thing for your browser to digest. Therefore, making it smaller, or minifying it, will improve the speed. Minifying is the process of taking all the code and putting it on one line. While this makes it nearly impossible for humans to read, a computer can breeze through it much faster without extra line breaks and spaces. Look for plugins that do this for you. Cloudflare offers this feature, too, so that is just another reason to use Cloudflare.
9: Minify CSS
See the above description for JavaScript. It's the same concept, but for CSS.
10: New Relic
New Relic is an x-ray like software that gives you a bunch of data on the performance of your application/website. While this software doesn't speed up your website, it gives you the necessary tools to figure out what needs to change. It even goes as far as listing your WordPress Plugins in order from most time-consuming to least. New Relic is one of my favorite tools for doing a performance audit. The software is a bit pricey, but when you host on Pantheon.io, they include it within their medium tier. I believe it's cheaper to host on Pantheon than straight-up to get New Relic stand-alone.
11: Reduce Plugins
Deleting or replacing plugins is one of the most common things to do to make WordPress sites faster. Each plugin runs PHP code which your server needs to interpret. The more Plugins, the more code, and therefore the slower the website will be.
Not all plugins are created equal.
Some will cause a massive strain on performance, while others will be negligible. Using software such as New Relic will help you pinpoint the Plugins causing your website to be slow.
Constantly do audits of your Plugins to determine what can be removed.
12: Rank Math over Yoast
These are plugins that add much-needed SEO features to WordPress.
Side note, why doesn't WordPress have fields for adding meta titles and meta descriptions? That's basic SEO, and I'd expect the top blogging platform to have this capability.
Most websites I inherit are using Yoast, which is a slow plugin. I switch to Rank Math (which is still slow) but faster than Yost. Rank Math has a migration feature to move you from Yoast seamlessly.
Rank Math is a free plugin that is feature-rich.
13: AMP for mobile
Accelerated Mobile Pages (AMP) is a protocol for web pages to follow a strict guide. This protocol enforces no JavaScript, which speeds up your website for mobile users. AMP is best for blog-style content where there is a title and body. Custom-designed pages are harder to leverage AMP. There is a non-JavaScript way to use Google Analytics still.
AMP is free and not very difficult to install. It's highly impactful for making your mobile WordPress website faster.
14: Refactor Custom Code (Add Trackers)
Have you written any custom code? Or copied something you saw on a forum into your functions.php? If yes, it's best to add a little more code that tracks how long your code takes to execute by sending this data to New Relic.
Add the end of your function(s) place the following code:
if (extension_loaded('newrelic')) {
newrelic_name_transaction("custom_event_name");
}
Then go to New Relic > Transactions, and you'll see how your code stacks up against other code. If it's slow, you may need to refactor.
15: Reduce Scripts
JavaScript is the slowest code for your browser to interpret. Removing any unnecessary scripts will improve your performance. Always look at the trade-off of how much speed you are gaining vs. what functionality you are losing. If you absolutely need to keep the script, look at adding defer or async to it so it doesn't hold up the rest of the page from loading.
16: Reduce Content
I don't turn to this one much, but if you have an obnoxiously long page, remove some sections from it.
17: Disable xmlrpc.php
Since the dawn of WordPress, this file/functionality has been present. Today, nobody uses it except hackers. When hackers try to exploit this, your server resources get consumed by their traffic. That is why I disable this service. Kinsta has an excellent article about this topic.
18: Disable Cron
Cron is supposed to be something that runs on a schedule. For example, every 7 days, delete spam comments. WordPress and many plugins use cron to run scheduled tasks. The problem is WordPress doesn't implement cron properly. Instead of launching every 7 days, WordPress checks if any cron jobs need to run every time somebody goes to a page. While the task will still only run every 7 days, it'll get checked every page load. Looking for cron jobs on every page load is time-consuming and unnecessary. I recommend disabling cron and using a different service to handle running your cron (which can still be done with it disabled).
19: Block wp-login.php
WordPress is the most prevalent CMS on the internet. WordPress has almost 50% market share for content management systems. This is why WordPress is the most hacked CMS on the internet. That and many websites go unmaintained, which makes them huge targets for exploits.
Hackers often target the login page of WordPress websites to gain access. Not once, or twice, but thousands of times. My largest website was getting 7,500 visits every 24 hours to the login page. To stop them, I added a rule to my firewall that makes the visitor complete a challenge (e.g., click all the boats) to gain access to the login page. Most hackers run automated software, so this tactic deterred all of them.
To do this on your website, route your traffic through Cloudflare and add a firewall rule.
20: Change Hosting
Not all hosting is created equally. Pantheon.io is my platform of choice for WordPress websites (literally every WP website I manage is on there). Pantheon doesn't like to call itself a "host" rather than a "website management platform" as its platform is diverse in features beyond hosting. Actually, they don't even own the servers. Instead, they use Google Cloud Platform and run their proprietary code on top of that.
Pantheon tunes its platform to perfection for WordPress. Redis, Varnish Cache, Fastly CDN, New Relic, and many more features are a part of the platform. Feel free to contact me if you'd like to leverage my partner pricing or get help migrating your website.
21: Reduce Fonts
Every font that is loaded causes performance strains. Beyond that, every font variation does too, such as bold, semi-bold, and italics.
While fonts can greatly improve the branding of a website, they come at the cost of performance. Consider removing fonts.
22: Move Redirects to PHP
This is a big opportunity that is not discussed online (probably because it requires a developer). Adding redirects to your website is a good SEO practice and will reduce your visitor's frustration. The problem is the redirects are stored in a database.
Here's how it works:
The visitor goes to a page.
PHP code is run. PHP connects to the database to see if the current path needs a redirect. If yes, PHP will redirect you to the right page.
This process runs every page you go to. Connecting to the database is costly and should be avoided if possible.
That is why I have a file called "wp-redirects.php" where I put my redirects. Now the process looks like this:
The visitor goes to a page. PHP code is run. Right there, redirects are checked for, and it's blazing fast - no DB connections.
My redirect plugin was one of the most time-consuming tasks on my website. Now it is literally the least time-consuming. Reach out if you need my help.
23: Convert MyISAM to InnoDB
The engines of your database can be MyISAM or InnoDB. Actually, each table can be either of those. I often see a mixture of these two. InnoDB offers higher reliability and performance.
Convert your database tables to use InnoDB to make your WordPress website faster.
24: Clean Database
While we are talking about databases, let's talk about clutter. When you install a WordPress plugin, it may need to create tables in the database to store its information. Or it will use existing tables.
Most plugins don't properly uninstall themselves when you remove them. They leave behind all the data and database structures they created. Extra bloat will slow down your database.
I use Advanced Database Cleaner Pro to scan my database for clutter. They have intelligent methods for checking for leftover or "orphaned" database items and can remove them for you. Always backup your database before making changes.
Hit me up!
Looking for someone to implement these tactics to make your WordPress website blazing fast? I've got you! I'll identify issues and implement fixes so your website is faster, ranks better, and drives more business!