WordPress is a free software that can be used by anyone used to create beautiful websites, blogs, and applications with little to no programming and web development knowledge. It is a flexible and user-friendly Content Management System that powers over 35% of the web. But, ease-of-use and simplicity often give rise to some other problems. One such area where WordPress can run into problems is website speed and performance. Therefore, WordPress performance optimization is essential for your website to load quickly and provide a better user experience.
You should not take the slow loading speed of your WordPress website for granted. Slow loading speed means that you are losing a lot of visitors due to long waiting times, your bounce rate is going up, and soon search engines like Google will take notice of that and start pulling down your search rankings. Slow loading speeds directly imply a bad user experience and search engines penalize your website for it.
Does your WordPress website take too long to load? Do you want to speed up your WordPress website? In this article, we are sharing some best practices and practical tips for WordPress performance optimization and for speeding up WordPress websites.
TABLE OF CONTENTS
- Why WordPress Site Speed Matters?
- How to check the speed of your WordPress website?
- What slows down a WordPress website?
- WordPress Performance Optimization – Best Practices
- Go for a high-performance Web Hosting
- Pick a Server closest to your Visitors
- Use a CDN
- Use Lightweight Themes
- Use Optimized Plugins from Trustworthy Developers
- Enable Caching
- Enable Compression
- Keep your WordPress Images optimized
- Never upload Audio & Video files directly to WordPress
- Update, Update, Update
- Practical Tips for WordPress Speed Optimization
- Ensure that your Website and the Database are in the Same Data Center
- Reduce Miscellaneous HTTP Requests
- Minify and Combine CSS & JavaScript file
- Disable Hotlinking
- Use a DNS level Firewall
- Add Cache-Control and Expires Header
- Change WordPress Memory Limit
- Eliminate Render-Blocking JavaScript and CSS
- Minify HTML, CSS, and JavaScript
- Control and Limit Post Revisions
- Delete old WordPress revision from your Database
- Load Scripts in the Footer
- Prefetch commonly used Domains
- Gzip and Brotli Compression
- Final Words
Why WordPress Site Speed Matters?
According to research, a one-second delay in load time can lead to a 7% loss in conversions, 11% fewer page views, and a 16% decrease in customer satisfaction.
Over 83% of visitors expect a web page to load in 3 seconds or less.
Pages that load within 2 seconds have an average bounce rate of 9% whereas pages that take 5 seconds to load have a bounce rate of 38%.
And, 79% of online buyers who have trouble with website performance say they will not return to the site to buy again.
And, a one-second delay in page load time can lead to.
What does this imply for you as a website owner?
You have very little time to present the visitor with what they want to see and convince them to stay. If your website takes too long to load, most users will leave the website even before it loads completely.
Moreover, Google and other search engines now penalize websites with slow loading speeds and push them down in search results. Slow WordPress Website Performance loading speeds can make you lose your hard-earned search rankings and your valuable organic traffic.
So it must be clear why your WordPress site speed matters so much. With a healthy website that loads quickly, you can get more traffic, subscribers, and conversions from your website. This is why you must speed up your WordPress website and perform WordPress speed optimizations.
How to check the speed of your WordPress website?
Simply loading your website on your computer does not give you a clear idea of the loading speed of your website. Modern Browsers store cache of all the websites you visit and automatically prefetch them as soon as you start typing an address.
There are a lot of tools available on the internet to help you accurately gauge your WordPress website’s page speed and figure out what you need to do to improve it. Here we are listing 2 such popular tools:
-
- Google PageSpeed Insights: It is one of the best free tools to check your WordPress website’s performance. It gives a detailed analysis of your website’s page speed, factors that are affecting it, and areas where you can make improvements to your website to reduce the loading time.
-
- GTMetrix: GTMetrix is also a great tool to check your WordPress website performance and to aid in WordPress performance optimization. It gives you a detailed waterfall analysis of all the elements that are being loaded on your WordPress website and the time taken by each element. With such a detailed report, you can easily find out which sections or plugins or elements are affecting the website page speed.
Ideally, you should aim to get a score of over 90 in Google PageSpeed insights test and loading time of under 2 seconds in GTMetrix. If this aim is proving to be too difficult, you can aim for a loading time of under 3 seconds in GTMetrix and a score of over 80 in Google PageSpeed Insights.
You can also use tools like Pingdom and WebPageTest to analyze your WordPress website’s speed and performance. Check out our detailed guide on 4 best tools to analyze your website speed to learn more.
What steps slow down the WordPress performance of a website
A lot of what you see in the aforementioned Page Speed tests will involve technical jargon which will be difficult for beginners to understand.
To speed up a WordPress site, it is essential to know what exactly is slowing it down. The basic and most-likely causes of the slow speed of your WordPress website are as follows:
- Hosting Quality: When your web hosting server is not properly configured or you have slow or bad quality hosting, it can hurt your website speed
- Caching Configuration: If your WordPress site is not serving cached pages, then it will overload your server thus causing your website to be slow or crash entirely.
- Page and Image Size: The total size of the webpage and the size of images that aren’t optimized for the web also determine the loading speed.
- Plugins: If you’re using bad quality or outdated plugins, then it can significantly slow down your website.
- Outdated WordPress or PHP: The version of WordPress or PHP that you’re using is out of date.
- External Scripts: External scripts such as font loaders and ads can also have a huge impact on the performance of your website.
Now that you know what slows down a WordPress website, let us explore how you can speed up your WordPress website and implement WordPress speed optimizations.
WordPress Performance Optimization – Best Practices
Now that it is clear why your WordPress website must load fast, we will get into the best practices to follow while building and managing your WordPress website. Consider these as advice to build a strong base for your WordPress website so that it performs well all the time.
Let us take a look at the best practices for WordPress performance optimization.
1. Go for a high-performance Web Hosting
WordPress hosting is a service that stores all your website data and makes it accessible on the internet. Think of it as rented accommodation for your website on the world wide web.
The WordPress host gives you an easy way to access the website data, manage it, and route it to your visitors. You should always go for a hosting plan that gives you high performance for your website.
Let us take a look at 5 different types of WordPress hosting plans so that you can make a better choice about the hosting plan that is right for you:
(a) Shared WordPress Hosting:
This is the cheapest hosting plan out there and is great for you if you are just starting a new blog or want to try out blogging. This is great for blogs and other less complex websites.
It’s called shared hosting because the user shares the server resources with another user. These plans are built especially for those who are looking for a basic plan without any high payment structure. You can check out hosting providers like HostGator, BlueHost, and GoDaddy for Shared WordPress Hosting.
(b) Managed WordPress Hosting:
If you are starting big and you want features such as automatic updates, website security, backups, and WordPress support, then you can certainly go for this option. In this case, you just have to worry about your content. Everything related to WordPress software will be taken care of by the hosting provider.
As compared to other hosting plans, websites running on managed WordPress hosting are faster and more secure. You can check out hosting providers like HostGator, BlueHost, and GoDaddy for Shared WordPress Hosting.
(c) Virtual Private Server (VPS):
In VPS hosting you pay for a virtual machine on a host machine. A host machine is a physical server that runs software that “splits” the server’s resources into multiple virtual machines with dedicated RAM, HDD space, CPU power, etc. So a VPS is like a virtual dedicated server.
It provides a much faster website experience than the other previous hosting plans. You can check out Digital Ocean, HostGator, BlueHost, and GoDaddy and more for Virtual Private Server hosting plans.
(d) Cloud Hosting:
A Cloud hosting plan can fit any type of your web hosting requirement and it will helpful for WordPress performance . You could be the owner of a small website or you could be running a big, feature-rich website, a cloud hosting plan will meet all your requirements in either situation.
A cloud hosting service offers a lot of flexibility and you can scale up or scale down the services as per your requirement. So even if you are planning to scale up your plan, you don’t need to go for another type of hosting altogether.
You can check out Amazon Web Services (AWS), Google Cloud, and Microsoft Azure for great Cloud Hosting services.
(e) Dedicated Hosting:
If you are planning to run a hefty web application on WordPress that requires high processing power and cannot afford to share the resource with any other user, then this is the type of plan that will benefit you.
A dedicated hosting plan implies that you have complete control of a server, and it is dedicated only to your website. So you don’t need to worry anymore about sharing the server resources with any other website.
We recommend AWS and HostGator for Dedicated Hosting plans.
You can also check out our guide on Best WordPress Hosting Providers of 2024 to learn more before making a decision.
2. Pick a Server closest to your Visitors
While hosting your WordPress website, you must determine where the majority of visitors or customers are coming from. This is because the location at which you host your website plays a significant factor in determining your overall network latency and TTFB. Simply put, it affects how quickly your website loads up for your users.
Network Latency implies the time and or delay involved in the transmission of data over a network. It is typically measured nowadays in milliseconds. But, it could be seconds also depending upon the network. The closer to zero the better.
TTFB implies time-to-first-byte. It measures how long the browser has to wait before it receives its first byte of data from the server. Again, the closer to zero the better.
So, all you need to remember is that you need to pick servers that have the lowest network latency and TTFB. Usually, these servers will be located close to your visitors.
3. Use a CDN
CDN stands for Content Delivery Network. These are a network of servers located around the globe. Their main purpose is to host and deliver copies of your WordPress web site’s static content such as images, CSS, JS, and video streams quickly and efficiently.
Don’t think of CDN as a replacement for your hosting provider, but rather an additional way to increase the speed of your site for increase WordPress Performance.
When you use a CDN, every time a user visits your website they are served the static files from whichever server is closest to them. Your web hosting server will also be faster since the CDN is doing a lot of its work.
So, a CDN ensures that your data flows between the server and the visitor through the shortest physical route to ensure the fastest delivery of content to the visitor. We recommend Amazon CloudFront or CloudFlare for CDN services
4. Use Lightweight Themes
When it comes to WordPress themes, there are a plethora of options available to you if you either want to shell out your hard-earned money or get something for free. The popularity of WordPress has ensured that there is no shortage of free and paid themes.
Now some paid themes can seem to come with all the fancy bells and whistles. But remember, that there is a price to pay with every shiny new plugin or new functionality that the theme offers. The said plugins and features impact the loading speeds of your WordPress website.
So, we advise you to go for a theme that is built only with the features you need and nothing more. Or, you can also go for a feature-rich theme but disable the features that aren’t in use.
Things such as Google Fonts, Font Awesome icons, sliders, galleries, videos and parallax scripts, etc are just a few of the many things that you should be able to turn off if you aren’t using them. You can turn these things off for WordPress speed optimization.
5. Use Optimized Plugins from Trustworthy Developers
Bad, unoptimized, and poorly code plugins load so much junk with your WordPress website that your website inevitably slows down.
You might have heard this nugget of wisdom, that you shouldn’t install too many plugins on your WordPress website. While it may be true in some scenarios, in most cases, the quality of plugins is more important than the number of plugins.
There is also another issue with uninstalling WordPress plugins. A lot of plugins leave behind additional files, folders, tables, and rows in your database even after uninstalling them from the Dashboard. This can add up to a lot of data over time and even slow up your site.
So, make sure that you are using authentic plugins from good developers and keep cleaning old files of deleted plugins from your FTP. Also, remove all the unused and unwanted plugins promptly.
6. Enable Caching
Caching is one of the most important and easiest ways to speed up your slow WordPress site.
What caching does is essentially save an HTML copy of the website for a specified time. For a website, we could set the cache to expire once a day. This means that once a day the website will load normally; it will detect a request, get the server to process the code, and show the result as HTML. It will also save the resulting HTML in memory.
The next time when someone loads the website, the cache would load the HTML from memory instead of getting the server to process it.
It reduces the amount of work required to generate a page view. As a result, your web pages load much faster, directly from the cache.
You can check out WP Super Cache if you’re looking for a free WordPress caching plugin for better WordPress Performance. You can also read our guide to the Best WordPress speed optimization plugins in 2024 to learn more.
7. Enable Compression
This is another potentially huge speed gain for your WordPress website. Compression reduces the size of various assets before sending them to your browser for interpretation.
The reason this is so helpful is that HTML and CSS uses a lot of repeated content. The more patterns you have in your content the better it can be compressed.
This is something that needs to be set up on your server through the FTP. You can check out this GTmetrix article for a quick tutorial on how to enable compression on your WordPress website.
8. Keep your WordPress Images optimized
According to studies, images account for about 50% of the average website’s page size.
If you are using camera raw images that are over 2-3MBs in size, then we must warn you. You are making your site load larger files than it needs to, which will inevitably slow down your website’s load time.
To optimize images for your website for best WordPress performance, you need to resize your image dimensions as well as compress image size. There are several plugins available that will automate this task for you and optimize all the images on your WordPress website.
Smush and reSmush.it are such free plugins (with pro versions) which will optimize and compress all the images on your WordPress website.
You will get the option to automatically serve scaled images to your visitor’s device, serve your images from a global CDN, and Lazy Load images to improve the perceived loading time.
9. NEVER UPLOAD AUDIO & VIDEO FILES DIRECTLY TO WORDPRESS WEBSITE
WordPress allows you to upload audio and video files to your WordPress dashboard and then add them to your website. Even though it might seem harmless, you must avoid doing this at all costs. So these audio and video files affect the WordPress Performance in page loading.
Please understand that uploading audios and videos to WordPress requires a lot of bandwidth. Your hosting provider could either charge you a hefty fee for going beyond the bandwidth permitted with your hosting plan or may even shut down your site entirely.
Hosting large media files puts a lot of strain on your server resources and increases the page size of your WordPress website. Instead, you can host your audio and video on platforms like YouTube, SoundCloud, DailyMotion, Vimeo, etc, and then embed the said audio or video wherever they want in the form of a simple link.
Point to remember: Never host audio or video on your WordPress site. Use specialized platforms to host your audio or video and then embed it on the pages of your website using URLs.
10. Update, Update, Update
As a website owner, it is your responsibility to keep your WordPress site, theme, and plugins updated to the latest versions. If you do not do that, it will most likely make your website slow and unreliable. This will also make you more vulnerable to security threats.
So, it is advisable to update your themes, plugins, and WordPress site as soon as possible after an update is available.
Practical Tips for WordPress Speed Optimization
Now that you know the best practices to follow while setting up and building your WordPress website, we can delve a bit deeper into optimizing your slow WordPress site for fine WordPress Performance.
In this section, we will deal with the technical aspects of optimizing a WordPress website and provide tips to optimize various aspects of your WordPress website.
If you follow all these tips and apply the suggested optimizations, you will see a significant improvement in your WordPress website load speed.
Let us take a look at all the WordPress performance optimizations that you can apply to your slow and laggy WordPress website!
1. Ensure that your Website and the Database are in the Same Data Center
You must check if your WordPress site and the database are located in the same data center. The vicinity factor is always important when talking about servers and hosting. Having the website and its database in the same data center is a healthy thing for WordPress Website performance.
This will make fetching posts and working with the database much efficient and smoother.
To find out the location of your server, you should ask your hosting providers. Sometimes, brands display their server locations in the signup process as well.
2. REDUCE MISCELLANEOUS HTTP REQUESTS
Themes and Plugins in WordPress can load all kinds of files from other websites. These files can contain scripts, sheets, images, and other resources from external sources like Google, Facebook, Analytics platforms, and more.
If your plugins are making a lot of these requests, then it can slow down your website significantly. Decreasing the number of HTTP requests that WordPress makes is very important.
You can use the waterfall analysis of the GTMetrix website performance report to know exactly how many unnecessary HTTP requests is your website making.
You can reduce the number of external HTTP requests by disabling styles and scripts or by merging them together in one file. Also, delete all unnecessary images and files, create CSS image sprite, do lazy loading, ignore irrelevant assets, and combine CSS & JS files. Some of these optimizations are discussed below.
3. Minify and Combine CSS & JavaScript files
Minifying and combining CSS & JS files can have a big impact on the WordPress performance and page load speed.
Minification of resources means removing unnecessary characters from your HTML, JavaScript, and CSS that are not required to load, such as white space characters, new-line characters, comments, block delimiters, etc. This increases your loading speeds as it decreases the amount of code that has to be requested from the server.
Concatenation is the process of combining your JavaScript and CSS files into one file with the object of reducing the HTTP requests. In some cases, this can increase the download time of your file, but it is usually better than having additional requests.
There are some plugins available that can automatically minify and combine CSS & JS files. Autoptimize is one such free plugin.
You can read our guide on Optimizing WordPress code using Minification, Concatenation, and GZIP Compression to learn more.
4. Disable Hotlinking
Doing this may not have a direct impact on your website speed, but it takes some pressure off your server. Hotlinking is when an image is served on a different website from your server, instead of uploading it on that website’s server.
In other words, instead of saving your image and uploading it to my server I just link to it on your server. This effectively means that I am stealing your bandwidth and you don’t get any traffic to show for it.
You can add this code to your .htaccess file to block hotlinking of images from your WordPress site.
#disable hotlinking of images with forbidden or custom image option 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]
PS: change “yourdomain.com” in the code above to the URL of your website.
5. Use a DNS level Firewall
A firewall helps you avoid brute force attacks, hacking attempts, and malware on your WordPress website. DNS level website firewall routes your website traffic through its cloud proxy servers. This enables them to send only genuine traffic to your server.
DNS level firewall is exceptionally good at identifying genuine website traffic in contrast to bad requests. They also significantly reduce the load on your WordPress hosting server which makes sure that your website does not go down and it will give a strength to WordPress Performance.
We recommend using DNS level firewalls like Sucuri or Cloudflare. These firewalls block malicious requests even before they reach your website.
6. Add Cache-Control and Expires Header
While the Cache-control header turns on client-side caching and sets the maximum age of a resource, the Expires header is used to specify a specific point in time at which the resource shall no longer be valid. While both the headers can be used together, you don’t necessarily need to add both of the headers. Cache-control is newer and usually the recommended method.
If your server is missing these headers, you can add them manually.
-
- Adding Cache-control header in Nginx: You can add cache-control headers in Nginx by adding the following to your server config’s server location or block:
location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico)$ { expires 30d; add_header Cache-Control "public, no-transform"; }
-
- Adding Expires header in Nginx: You can add Expires headers in Nginx by adding the following to your server block. In example given below, you can see how to specify different expire times based on different file types:
location ~* \.(jpg|jpeg|gif|png|svg)$ { expires 365d; } location ~* \.(pdf|css|html|js|swf)$ { expires 2d; }
-
- Adding Cache-control header in Apache: You can add cache-control headers in Apache by adding the following to your .htaccess file. Snippets of code can be added at the top or bottom of the file (before # BEGIN WordPress or after # END WordPress):
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|svg|js|css|swf)$">
Header set Cache-Control "max-age=84600, public"
</filesMatch>
-
- Adding Expires header in Apache: You can add Expires headers in Apache by adding the following to your .htaccess file:
## EXPIRES HEADER CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType image/svg "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresByType application/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 2 days" </IfModule> ## EXPIRES HEADER CACHING ##
7. Change WordPress Memory Limit
As specified by the WordPress Codex, with WordPress Version 2.5, the WP_MEMORY_LIMIT option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be crucial if you receive a message such as “Allowed memory size of xxxxxx bytes exhausted”.
By default, WordPress will attempt to increase the memory allocated to PHP to 40MB for a single site and 64MB for multisite. If you’re running into the memory size exhausted error you can try increasing the PHP memory limit in WordPress.
Add the following to your wp-config.php file, just before the line that says “That’s all, stop editing! Happy blogging.”:
define( 'WP_MEMORY_LIMIT', '256M' );
8. Eliminate Render-Blocking JavaScript and CSS
You might see a warning about render-blocking JavaScript and CSS while checking your website’s performance in Google PageSpeed Insights or GTMetrix. This warning appears when you have files preventing the page from loading as fast as possible.
Some specific JS and CSS are sometimes conditional, meaning that they are not required to display above-the-fold content. You can prevent them from becoming render-blocking by using async and defer attributes.
To eliminate render-blocking JavaScript and CSS for better WordPress Performance you need to do the following:
Clear JS from Critical Rendering Path: You can move JavaScript out of the critical rendering path by adding either the ‘async’ or the defer’ attribute to the script HTML elements that call JavaScript resources.
The ‘async’ attribute instructs the browser to start downloading the resource right away without slowing down HTML parsing. Once the resource is available, HTML parsing is paused so the resource can be loaded.
The ‘defer’ attribute tells the browser to hold off downloading the resource until HTML parsing is complete. Once the browser has finished with the HTML, then it will download and render all the deferred scripts in the order in which they appear in the document.
Optimize Delivery of CSS Resources: Optimizing the delivery of CSS essentially means you need to figure out how to make it non-render blocking.
You should identify the styles that are required to render above-the-fold content and deliver those styles inline with the HTML. You should use CSS conditionally on devices only when needed. Also, load the remaining CSS asynchronously.
Alternatively, you can also use WordPress plugins like Autoptimize and Hummingbird to Optimize the Delivery of CSS Resources.
9. Minify HTML, CSS, and JavaScript
We can reduce the amount of data the browser has to download by minifying HTML, CSS, and JavaScript resources. Minification is the process of removing unnecessary characters like comments and whitespace from the source code. These characters are extremely useful in development, but they’re useless for the browser to render the page.
You can check out our detailed guide on Optimizing WordPress code using Minification, Concatenation, and GZIP Compression to learn more.
10. Control and Limit Post Revisions
In Post revisions, every time you change the content, a new copy of the post is saved in the database instead of deleting and replacing the previous one. This is to ensure that you always have a chance to revert. But, it increases the database size, and a large size database can cause many problems.
To check this, you can limit the frequency to autosave a post. From the root folder of your WordPress installation, open wp-config file with any file editor and write the code given below before the code require_once(ABSPATH . ‘wp-settings.php’);
define ('WP_POST_REVISIONS', 3);
It will limit the number of revisions to 3. Meaning, your WordPress will confine itself to save only three revisions, thereby reducing the burden on your database.
You can also set the frequency to autosave a post using the following code:
define('AUTOSAVE_INTERVAL', 300 ); // seconds
Here, 300 seconds means, your post will be autosaved every 5minutes rather than the default settings.
You can also completely disable post revisions in WordPress using the following code, although it is not the best practice to completely disable them:
define ('WP_POST_REVISIONS', false);
11. Delete old WordPress revision from your Database
After you have disabled or limited your post revisions, you will also want to clean up and delete old revisions. We recommend temporarily installing the free WordPress plugin WP-Optimize for this task.
With this plugin, you can clean all auto-draft posts, post revisions, remove spam comments, remove unapproved comments, transient options, trackbacks, and pingbacks. In the latest version of WP-Optimize, you can also schedule auto-cleanup as per your requirements.
Once you are done cleaning up your WordPress database, you can remove this plugin from your WordPress website.
12. Load Scripts in the Footer
Make sure to load scripts in the footer, unless you absolutely must use a script in the header. When using the wp_enqueue_script() function set the fifth parameter to true to get the script to load in the footer.
This will increase the apparent speed of the website and also helpful in WordPress Performance. It doesn’t decrease requests or file sizes but it does make sure that the essential content is loaded first. Besides, if a script gets stuck, it doesn’t prevent the content from being loaded.
13. Prefetch commonly used Domains
Prefetching is similar to caching in the fact that you are telling the browser to look up the DNS settings a little before they are actually needed. It combs the page and queries any prefetched domains that are not already cached so that they load quicker subsequently.
You can prefetch domains in WordPress by adding the domain syntax to your header.php file between the
<head>``</head>
tags. This process will only be performed when possible and is non-blocking. Let us take a look at some examples:
- Prefetch Google Fonts:
<link rel="dns-prefetch" href="//fonts.googleapis.com">
- Prefetch Google Code (jQuery):
<link rel="dns-prefetch" href="//ajax.googleapis.com">
- Prefetch Google Analytics:
<link rel="dns-prefetch" href="//www.google-analytics.com">
14. Gzip and Brotli Compression
Gzip is a type of compression that compresses web pages, JavaScript, and CSS at the server level before sending them over to the browser.
To apply Gzip compression in Apache, add the following command to your .htaccess file:
<ifmodule mod_deflate.c="">
# Compress HTML, JavaScript, CSS, 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 required 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>
To apply Gzip compression in Nginx, you can add the following code to your nginx.conf file:
gzip on; gzip_comp_level 2; gzip_http_version 1.0; gzip_proxied any; gzip_min_length 1100; gzip_buffers 16 8k; gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_disable "MSIE [1-6].(?!.*SV1)"; gzip_vary on; You can check out our detailed guide on Optimizing WordPress code using Minification, Concatenation, and GZIP Compression to learn more.
Final Words
As you might have already guessed, we are obsessed with all the different ways you can speed up a WordPress website. Having a fast site helps boost your rankings, improves crawl-ability for search engines, improves conversion rates, increases time on site, and decreases your bounce rate. Not to mention the fact that everyone loves visiting a fast website and visitors consider it as a part of great user experience.
We hope that this WordPress performance optimization guide was helpful and that you were able to learn a few important things and apply them to your WordPress site. If so, please take a moment and share it. It’ll help more people like you who want to speed up their WordPress website.
Did we miss anything important? If yes, then we’d love to hear about it. Let us know your tips for speeding up a WordPress website in the comments below.
Hi, I desire to subscribe for this blog to get newest updates, therefore where can I do it please help.
I enjoy what you guys are up too. This sort of clever work and exposure!
Keep up the fantastic works guys I’ve incorporated you guys to my blogroll.
Thanks so much for giving me remarkably memorable chance to discover important secrets from this blog. I’m just usually fascinated considering the unbelievable advice served by you.
very nice post, I certainly love this website, keep on it
Spot on with this write-up, I truly think this website needs much more consideration. I’ll probably be again to read much more, thanks for that info.
My brother recommended I might like this blog. He was totally right. This post actually made my day. You cann’t imagine simply how much time I had spent for this info! Thanks!
Woah! I’m really loving the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between user friendliness and appearance. I must say you have done a very good job with this. Additionally, the blog loads extremely fast for me on Safari. Superb Blog!
Very informative blog!
Can I simply say what a reduction to seek out someone who really knows what they’re speaking about on the internet? You undoubtedly know the right way to bring a problem to gentle and make it important. More individuals have to read this and understand this side of the story. I cant consider you’re not more common because you positively have the gift.
I’m not that much of a online reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your website to come back later on. Cheers
Excellent weblog right here! Also, your site is so much up very fast! What host are you the usage of? Can I am getting your affiliate link to your host? I desire my website loaded up as fast as yours 🙂
Great article and straight to the point. I don’t know if this is truly the best place to ask but do you people have any thoughts on where to employ some professional writers? Thanks 🙂
Thanks for sharing superb information. Your website is so cool. I am impressed by the details that you have on this website. It reveals how nicely you understand WordPress Performance Optimization. Bookmarked this web page, and will come back for more articles.
Everyone loves what you guys are usually up too. This type of clever work and exposure! Keep up the excellent works guys I’ve added you guys to my own blogroll.
Hi there, You have performed an excellent job.