WordPress is amazing an amazing App. It started off as a simple blogging platform and turned into the world’s most used Content Management System, with over 10,000 themes and thousands of plugins extending its functionality.
With that kind of flexibility comes certain issues, namely, WordPress can become slower the more you try and expand its functionality. But, there are ways to improve performance and optimize WordPress.
Here’s our step by step guide on how to improve the performance of your WordPress website.
Step 1. Measure speed
Google PageSpeed service is an exceptional tool that helps you measure your WordPress website’s performance and receive precise, definite feedback on how to make improvements.
Ideally, your website should load between 2 and 5 seconds. We won’t go in-depth on Google PageSpeed since it’s a complex service; however, here’s a quick breakdown of each section it shows:
- Core Web Vitals Assessment – Google’s Core Web Vitals are a collection of metrics that measure how well a page performs in key areas of the user experience. The results for a given URL are displayed in a three-way status measure (Poor, Needs Improvement, and Good). The performance metrics are derived from real-world user input. You can read more about it here.
- Diagnose performance issues – The entire test allows you to track the performance of your website in performance, accessibility, and SEO terms. The performance section shows speed tests related to the network, server, and other measures. Data in the opportunities section provides suggestions to improve your page speed, and the data in the diagnostics section shows the exact issues you must deal with.
- Accessibility – This section shows information on how to improve the accessibility of your website further.
- Best Practices – These suggestions allow you to fix the general errors with your website and ensure everything is running smoothly.
- SEO – This section contains tips on how to improve the SEO of your website.
Additionally, you can use these third-party services to compare results with the PageSpeed tool:
Step 2. WordPress
Updates
WordPress is an open-source project, so it’s updated frequently. These updates introduce new features and fix bugs, issues, memory leaks, etc. This is why it’s essential always to keep your WordPress and its plugins and themes up to date. Not doing that may make your website vulnerable, slow, and unreliable.
Plugins
Having a lot of unnecessary or outdated plugins is likely the most common cause of a sluggish website. Poorly coded plugins will load a lot of bloat not needed for your website, which slows it down tremendously.
Here are some quick guidelines to follow:
- Deactivate and delete any unnecessary plugins.
- Turn off settings you don’t utilize in your plugins.
- Never duplicate functionality with plugins (for example, don’t use two plugins for the same SEO features).
- Run a speed test before and after installing a new plugin to see how it will affect your site speed.
- Make sure only to use popular plugins. You can see if the plugin is compatible with your version of WordPress when you go to install it.
Here’s a list of some plugins known to cause site speed problems when running our tests:
- AddThis
- Social Discussions
- Socialable
- Similar Posts
- All-In-One Event Calendar
- Backup Buddy
- WPML
- Yet Another Related Post Plugin
- Beaver Builder
- Better WordPress Google XML Sitemaps
- Constant Contact for WordPress
- Sharebar
- ShareThis
- Share Buttons by AddToAny
- Share Buttons by E-MAILiT
- Contact Form 7
- Contextual Related Posts
- Essential Grid
- Facebook Chat
- Google Analytics
- Jetpack
- NextGEN Gallery
- Really Simple Share
- Reveal IDs
- Revolution Slider
- ShareThis
- WP Facebook Like Plugin
- WP Social Bookmarking Lite
- WP Social Share
- Tribulent Slideshow Gallery
- Ultimate Social Media & Share
- VaultPress
- WooCommerce Customer History
- WordPress Facebook
- WordPress Related Posts
- WordPress Popular Posts
- WordPress Social Ring
- WP Bakery (formerly Visual Composer)
You can also use GTMetrix‘s Waterfall view to find slow plugins by hovering your mouse cursor over the entries.
Themes
Once you have followed our advice on plugins, the next thing to look at is the theme you’re using. Same as with plugins: delete inactive themes and only use themes regularly updated by the theme author.
Note that most beautiful and complex themes are poorly coded and contain many elements that can slow down your website. It’s usually better to go with a more straightforward theme that doesn’t have unnecessary features or complicated layouts, as you can always build those features using quality WordPress plugins.
If you’re unsure how to perform these steps or need help with your website, check out Skystra WordPress Hosting, as we had positive experiences with their support staff in our WordPress hosting review for 2023.
Step 3. Optimization
Background processes
Scheduled posts and updates won’t slow down your website, but it is essential to keep an eye on the backup plugin you use and search engine crawlers. Make sure your backup plugin only runs during low-traffic times on your website, and adjust daily backup to a couple of days per week if you don’t post new content daily.
For search engine crawlers, make sure to often check crawl reports in Google Search Console, as crawls that hit an error can cause a slowdown.
Excerpts
WordPress shows the full content of the article/post by default, and it can slow down your homepage and archive pages. We recommend you enable only excerpts on your archive pages to speed up the loading times. You can do that from the Settings > Reading section by selecting “For each article in a feed, show: Summary” instead of the “Full Text” option.
Comments
It’s fantastic if you have tons of comments on your posts, but comments do affect the loading speed of those posts. It’s recommended to split comments into multiple pages by going to Settings > Discussion section and enabling the “Break comments into pages” option.
We also recommend disabling Gravatars, especially if you have a lot of comments, as they will take a long time to load. There are a couple of options you can use:
- Host Gravatars locally on your server using the WP User Avatar plugin
- Set the default Gravatar to blank
- Disable Gravatars outright
- Limit the Gravatar images to a small dimension
Audio and video files
WordPress automatically displays uploaded video and audio files in an HTML5 player, but playing these will utilize much bandwidth. We recommend uploading your audio or video files to Youtube, Vimeo, or SoundCloud and then simply embedding them on your website. Since WordPress has a built-in embed feature – it will save both server resources and your bandwidth.
Pages
Use Google Analytics to find slow pages and recommendations for them from the left-hand menu > Behavior > Site Speed > Speed Suggestions:
Disable WP-cron
Using a system cron-job service will always improve performance over WordPress cron (WP-Cron), so you might also consider disabling that.
Step 4. Caching and compression
Caching
Utilizing caching mechanisms is the simplest and fastest way to achieve results. For example, plugins like W3 Total Cache or WP Super Cache are super easy to install, and their purpose is to cache your WordPress website posts and pages as static files.
These static files get served to your users, reducing the processing load on the server. Caching can improve performance several hundred times over for reasonably static pages.
Compression
Websites load faster when the code they use is compressed, and the difference between the loading time of compressed and uncompressed code can be as much as 300%.
Gzip compression works with almost all modern browsers, and you can enable it using a WordPress plugin. Using a plugin reduces the chances of an error when changing the code, so you can consider using WPO Tweaks or W3 Total Cache plugins, which can do this automatically.
If you want to enable this manually, please check the below examples.
Apache
Ensure that the mod_filter module is loaded in Apache on your server, and paste the following code to the websites .htaccess file:
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
NGINX
For NGINX, add the following code to your nginx.conf file:
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_vary on;
gzip_types text/plain text/css text/javascript image/svg+xml image/x-icon application/javascript application/x-javascript;
Images
Non-optimized images are the most frequent cause of speed issues on a website. You should always use photo editing software to optimize your images before uploading them to your site.
There are two most common image formats used for web practices:
JPEG – Compressed file format which reduces both size and image quality
PNG – Uncompressed file format which has high quality but a larger file size.
A general rule of thumb on the usage of these is:
- Use JPEG if the image has a lot of various colors
- Use PNG if you need a transparent image
- Avoid using irrelevant images on your site.
- Make sure all images on your website are optimized. Plugins like Smush.it and WP Smush.it can help with this tremendously.
Make sure to resize large images and scale them properly using this table as a reference:
- Slider images: 1903(w) x 400(h)
- Carousel images: 115(h)
- Widget images: 414(w)
- Fullwidth blog post images: 680(w)
- Featured images: 250(w) x 250(h)
Fonts
If you’re using Google Fonts, you may see errors in page speed tests related to cache validators. To fix this and improve performance, download the OMGF plugin, which allows you to host Google Fonts locally on your server and save resources.
CDN
A Content Delivery Network delivers your website content to people more efficiently and swiftly based on the visitor’s geographical location. CDN consists of servers that are located in different regions around the world to improve content delivery for every geolocation.
From our experience – we recommend using Cloudflare as it’s one of the biggest CDN providers on the web and works well with WordPress.
Step 5. Advanced optimization tips
WordPress database
If your website is up for a while now, your database probably contains a lot of information that is not needed anymore. You can clean that information by using a WP-Sweep plugin and improve the performance of your site. This plugin lets you clean revisions, unused tags, deleted posts, etc.
WordPress heartbeat
The WordPress heartbeat API shows real-time plugin notifications. It also notifies you when another user is editing the same post as you. This can cause sluggishness and consumes quite a bit of server resources. We recommend using the Heartbeat Control plugin to disable this behavior and to save on server resources.
External HTTP requests
WordPress plugins and themes load many files from other websites/URLs, such as scripts, images, or stylesheets. Lots of these are optimized to load quickly, but if you have a ton of these requests, it could slow down your website quite a bit. To reduce the number of external HTTP requests, we recommend using a Merge + Minify + Refresh plugin, which will merge all CSS and scripts into groups and then minifies them for better performance.
Additionally, you can use this list of common domains to pre-fetch with the Pre* Party Resource Hints plugin to save on the load time.
Limit posts revisions
Some plugins don’t work well with WordPress revisions, especially if you have many. If it doesn’t exclude revisions, each search through them can potentially slow down your website.
To limit the number of available revisions for each article, insert the following code to your wp-config.php file:
define( 'WP_POST_REVISIONS', 4 );
This particular code will limit WordPress to saving only four revisions per each post or article and remove older ones automatically.
Pingbacks and trackbacks
Pingbacks and trackbacks are no longer used much for SEO; you can disable them in Settings -> Discussion under Discussion Settings:
Hotlinking
Having good content on your website will likely draw attention, and it’s possible to have someone ‘steal’ it from you. One way to steal is through hotlinking, which means they link your images directly from URLs on your website (and server), which means you’ll end up paying for bandwidth instead of them.
To prevent hotlinking, add the following code to your website .htaccess file:
#prevent hotlinking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
NOTE: Make sure to replace yourdomain.com URL with your domain name.
Long posts
If you have a lot of long posts – this is great for search engines, but it affects loading times on your website. Consider splitting long posts into pages to prevent this from happening. Since WordPress has this functionality built-in, you can use the following tag in your article where you want to split it into the next page:
<!––nextpage––>
Lazy loading
If you use a lot of videos, images, galleries, etc., on your website – you could profit from lazy loading. Lazy loading will only display content on the viewers’ screen instead of loading all the assets simultaneously and improve page loading time.
We recommend Lazy Load by WP Rocket plugin, which you can use to lazy load images, iframes, videos, etc.
SSL
Ensure that you have no mixed content errors (where you have both HTTP:// and HTTPS:// URLs in your database) and that an active SSL is running on your domain and WordPress installation.
To fix any HTTP links, we recommend using the Better Search Replace plugin to update all URLs in your database to update the links to HTTPS URLs.
Bad bots
Using the Block Bad Queries plugin can help you automatically block bad known bots and quickly reduce CPU load from bad bots.
In addition, you can go to Google Search Console and in Site Settings, reduce the crawl rate to limit the amount of Google requests to your website. You can also do this for Bing using the crawl control settings option.
Use the comment section to share which tips helped improve your WordPress website’s performance or share new ones!