How to improve the performance of your WordPress sites?

For simple blogs, I advise you to create them as lightweight static websites (like the one you're currently reading). That's the best way to ensure a stable performance. For more sophisticated projects, involving dynamic data queries, my platform of choice remains WordPress. 

But if you've already created WordPress sites, you know how painful it can be to wait a few seconds for a page to load when it's not been optimized. And besides the pain for the creator and the visitors, slowness is also a competitive disadvantage in terms of SEO: Google loves fast websites (because people love fast websites, as simple as that). 

Choose an outstanding WordPress hosting provider

The #1 factor you should pay attention to is the quality of your hosting provider. I've tested a few (Gandi, DreamHost, A2Hosting,...) and after years of experience I came to the conclusion that the best choice is SiteGround.

These guys know how to handle hosting and they provide stellar support, fast and detailed, with a smile. Moreover, the dashboard UI is gorgeous and very practical, a pleasure to use.

Recently I had an issue with shared hosting on their platform and they offered to migrate my site to another server, quickly and free of charge, late in the evening on a Friday night. Much appreciated! Their caching plugin, SG Optimizer, is very easy to configure.

Siteground gorgeous UI
Siteground gorgeous UI

Select the right theme & plugins

If you're developing a complex project, you'll need a good all-round visual builder. Instead of using a theme including its own builder, I advise you to decouple the theme and the builder. In my recent projects, I've been using Hello, a lightweight theme by Elementor and Elementor Pro (visual builder plugin). 

For additional functions, you will need either custom coding or additional plugins. Make sure to select well rated / properly coded plugins. Don't hesitate to buy Premium plugins for critical functions. You will get a better support and, most of the time, much needed advanced features. 

Here are a few plugins I've recently added to my projects (all approved for their good performance).

Search & Filter Pro (their developers provide quick and effective support). A very good plugin to add advanced search capabilities on any part of your site, incl. custom posts and custom taxonomies. It's a great tool for faceted search. They offer a very affordable Developer Licence, at $75 (unlimited sites).

WordFence, a security plugin which will help prevent brute force attacks and other malicious intrusion attempts (incl. malicious bots, which can slow down your site). It will also alert you via email when you must update critical plugins.

Rate My Post, a lightweight rating plugin, which works like a breeze with Elementor templates (meaning for instance that you can insert the shortcode in a custom post type template and get a different rating for each post, which isn't the case with all rating plugins).

GDPR cookie compliance, an easy to set up GDPR banner plugin, works really well with WPML for translation purposes.  

Custom Post Types UI, the plugin of choice to create an unlimited variety of custom post types, with advanced configuration. Pro tip: don't forget to set "exclude from search" to false and "has archive" to true if you want your custom post types to be searchable and have their own archive page (important if you're creating an archive template with Elementor and want this template to apply to your custom post type archives). 

Advanced Custom Fields, a must-have for any sophisticated data-driven WordPress project. Enables you to add... advanced custom fields to any type of post, incl. custom post types.

Header / Footer code manager, an easy way to manage the code snippets you'll have to add in the Header and Footer sections of your site (pixels, analytics, verification codes,...). 

Updraft Plus backup/restore, a much needed backup plugin. You can choose the backup cloud destination (I'm using DropBox). 

WPOptimize. I'm using this plugin to clean / optimize my databases, deleting posts revisions, trashed posts, transients, etc. 

WP All Import, which I'm using in conjunction with Advanced Custom Fields (requires their ACF add-on). It's a great tool to automate (custom) posts creation. You can for instance use a Google Sheet as the (dynamic) source of data for your posts. I will probably write a detailed article about the process. 

Ajax Search Lite. I've been using Algolia for a few projects but this plugin is free and also offers instant results capabilities, without adding too much bloat to your site. You can filter suggestions by post types, taxonomies, etc. Search fields will look great with some CSS tweaking (don't use their default template). 

Query Monitor, which shows you the details of all queries for each page of your site. A great tool to identify slow queries and have a fairly good sense of the speed of your site. 

Unload unneeded scripts on a per page basis

One of the main issues with WordPress is that it tends to load (plugin & other) scripts on all your site's pages even when the feature isn't used on a specific page (think about a Map or Timeline plugin for instance, only used on a handful of pages). 

There's an easy (premium) solution to manage scripts on a per page basis. It's called Asset CleanUp Pro and is well worth the $39 you'll spend. By unloading scripts on a per page basis (or sitewide when it applies), you'll reduce the amount of queries, which will drastically improve the performance of your site.

AssetCleanUp Pro also lets you move some CSS and Javascript files from <Head> to <Body> to reduce render-blocking (and also defer CSS loading). It will help you solves common issues spotted by GT Metrix, Pingdom or Google PageSpeed Insights.

Disable WP-Cron for faster performance

The default WordPress Cron procedure can have a negative impact on your site's performance. By default wp-cron.php is executed every time someone loads a page on your site to check whether there's a scheduled task to be done. You can imagine the impact on your site's performance...

You can disable WP-Cron by adding the following piece of code to your wp-config.php file, at the root of your WP install, just before "That's all, stop editing!". 

define('DISABLE_WP_CRON', true);

Then you'll have to schedule System Cron (since you can't completely disable cron jobs) by adding a rule via your hosting panel.

If you're using SiteGround, it's in the Devs section / Cron Jobs. 

SiteGround Cron Jobs

Here's the command you'll need to insert (set it to be executed every 30 minutes): 

wget -q -O - http://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Replace yourdomain.com by your domain. It will execute the wp-cron.php file every 30 minutes, much better than on each visit of your site!  

Don't use heavy images + offload your images to Amazon S3

It's crucial to use the right size of image for each placement on your site.

For instance, the size of an image isn't the same on a grid of thumbnails (smaller) vs the featured position (larger) at the top of an article. Don't resize a huge image with CSS in a grid gallery, pick the right image size for each widget.

There are also multiple plugins to compress your images on the fly, e.g. ShortPixel, which will help you reduce the weight of your images for all thumbnail sizes. 

I also advise you to host / offload your images on Amazon S3. I've recently switched to a new plugin for that purpose, MediaCloud. You can upload your images to S3 and remove them automatically from your WP install (which in the long run will cost you far less than hosting your images where you host the WP application + it will decouple the core application from the visual assets).

Important: don't forget to enforce HTTPS and set up a custom domain (using Cloudfront in conjunction with S3, e.g. img.yourdomain.com). You don't want to display images from the Amazon.com domain, it won't contribute to your SEO! 

Choose a good caching plugin

Caching pages for repeat visitors is the easiest way to improve your site's performance (but you'll need to optimize your queries for the initial visit, following all the tips listed above).

Since I've started running WordPress sites on SiteGround, I've been using their SG Optimizer plugin, installed by default, which includes Dynamic Caching powered by NGINX, GZIP compression, images Lazy loading and browser caching. Note: for JS & CSS files minification, I'm using the features of AssetCleanUp Pro. 

If you're not on SiteGround, I advise you to use WP Fastest Cache. I've always had very good experiences with that plugin. 

If you have other tips to improve the performance of a WordPress site, don't hesitate to share them in the comments below. 

You can subscribe to my newsletter for weekly marketing & technical tips. 

 





Comments