Your WordPress website has a core. Its core includes hosting, theme, and plugins. This is the origin of every page your site serves. Speed and performance are determined here, at the web page’s origin, not at the edge where the page is viewed.
If you want supreme performance from your site, then look right to the core and strengthen or, better said, optimize the origin of your content.
Here is what an optimized core for a WordPress website includes:
– reliable DNS
– hosting configured specifically for WordPress
– a clean theme that is devoid of bloat
– a plugin list trimmed of fat
If you are serious about your site, and if you don’t want it crashing the first time you get a nice stream of traffic, then you need to host it on servers specifically configured for the complexities of hosting WordPress.
The whole process becomes quicker and more reliable when NGINX is involved and when entire pages, or elements of pages, can be saved on the server and loaded pre-generated when called. This enables web pages to be served much faster to more potential users at once.
1. Use a Solid Framework/Theme
Behind every WordPress site, there is a theme or framework and along with that can sometimes come bloat. Every theme is coded differently and because of that there are those that are better than others. The default WordPress themes such as Twenty Fifteen is actually quite fast because it is very lightweight.
2. Utilize Caching
Caching is another important factor when it comes to speeding up WordPress. Caching stores your pages and posts as static files which are then served to your visitors, reducing the processing load on your server.
You can utilize caching by using WordPress caching plugins, implementing browser caching, and server-side caching.
Bypass PHP for Cached Pages
Below is a more advanced Nginx configuration to bypass PHP for cached pages. This example is optimized for the Cache Enabler plugin.
Browser Caching – Add Expire Headers to WordPress
You can also leverage browser caching by adding expire headers. Expires headers tell the browser whether they should request a specific file from the server or whether they should grab it from the browser’s cache. By adding them, it reduces the amount of HTTP requests that are needed. Some WordPress caching plugins allow you to add this, but you can also add the code to your .htaccess file.
Besides WordPress caching plugins and browser caching you and also take advantage of server-side caching. This is usually done on higher traffic sites. Varnish cache can be very powerful when combined with a caching plugin, and a CDN.
Prefetch Commonly Used Domains
Prefetching is similar to caching in the fact that you are telling the browser, like Chrome, to lookup the DNS settings ahead of when they are actually needed. It combs the page and queries any prefetched domains that are not already cached so they load quicker later on.
You can prefetch domains in WordPress by adding the domain syntax to your header.php file between the <head> </head> tags. This process is non-blocking and will only be performed when possible.
3. Implement a Content Delivery Network
KeyCDN offers content delivery services via a pay as you go program. Depending upon your bandwidth, many sites can implement a CDN for less than a dollar per month! To quickly deploy a CDN for your WordPress sites KeyCDN developed a new light-weight plugin called CDN Enabler. It’s freely available and setup can be completed within minutes.
4. Optimize WordPress Database
WordPress has a tendency to start slowing down if you don’t keep your database optimized. There are ways to keep your database clean by disabling and or limiting post revisions, deleting old revisions, and being aware of the 100 page WordPress limitation.
Disable and Limit WordPress Post Revisions
WordPress creates a lot of revisions when you are writing. If you aren’t careful you can end up with thousands of unnecessary revisions in your database.
5. Optimize Images using Lossless Compression
As we mentioned in a previous post on lossless image compression, on average 56 percent of a website’s page weight is made up of images. So optimizing your images and compressing them down should definitely be high on your priority list. Lossless compression is a method used to compress images, reducing the size of the image, and yet retaining the quality.
6. Gzip Compression
7. Reduce Number of WordPress Plugins
A common reason for WordPress slowing down is that people have too many plugins running, creating too much overhead for their webserver to handle. Keeping the number of plugins you have installed to a minimum is very important. Before simply deleting plugins there are a couple ways you can determine which ones are slowing down your site. Then after analyzing the impact on load times, ask yourself if the plugin is something you really need or perhaps you could accomplish the same thing a different way.
8. Optimize Web Font Performance
As we wrote in our recent case study on analyzing web font performance, 57% of websites are now using custom fonts, which is an 850% increase since 2011. We noted that it is important to serve only the fonts you need, such as WOFF and WOFF2 formats. Services such as Typekit base64 encode all the formats, which can increase download times and slow down your site.
In our tests, Google fonts performed well because of the use of their CDN and serving only WOFF formats. Open Sans was the fastest of the top 10 most popular fonts. If you are going for pure speed and still want to use Google fonts, the best combination in WordPress would be to use Open Sans and then a web safe font such as Arial.
9. Optimize Font Awesome Icons
When it comes to Font Awesome you have a couple options to speed them up. If your theme already includes Font Awesome you might need to tweak your theme for the following to work.
10. Lazy Load Images, Videos, and Disqus
Lazy loading is a concept where you delay the loading of the object unit the point where it is needed. In WordPress, this usually refers to not loading the object until a user scrolls down the page or using an on-click event. You can lazy load all sorts of content, from images to videos and even the Disqus commenting system.
When it comes to speed in WordPress minification and concatenation can play a big role.
12. Reduce Misc HTTP Requests
Decreasing the amount of HTTP requests that WordPress makes is very important. Follow these instructions on how to fix the gravatar problem and the additional request to load emoji’s since WordPress 4.2
13. Disable Hotlinking
Hotlinking refers to someone directly linking to one of your images on their own server. What this means is that when someone visits their site it has to load the image from your server, taking up your bandwidth. You can disable hotlinking by adding the following code to your .htaccess file and updating it with your domain name.
14. Disable Pingbacks and Trackbacks
Pingbacks and trackbacks are considered by some as a legacy feature now, and they can cause slowness when it comes to page speed. With Ahrefs, Google alerts, and other brand monitoring tools now available, there are much better ways to see if someone has linked to your content.
You can disable pingbacks and trackbacks under the discussion settings in WordPress. Note: this only applies to new posts.
15. Specify Image Dimensions
16. Fix The admin-ajax.php Slow Problem
17. MySQL Tuning
Optimizing MySQL is also very important. Unfortunately this is very specific to your environment and your setup so we can’t provide recommended configurations. The MySQL/MariaDB configuration file is normally located in /etc/my.cnf. Here are a few settings though to keep an eye on.
18. Choose a Reliable Web Host
And of course, last but not least, choosing a reliable and fast web host can be one of the most important decisions you will make when trying to figure out how to speed up WordPress. We recommend staying away from cheap shared hosting as they tend to overcrowd their servers and you will end up sharing resources between hundreds of people. The old saying, “You get what you pay for,” definitely applies here. We suggest going with a VPS or managed WordPress host depending upon your level of expertise and time.