15 Quick Ways to Speed up Your WordPress Site

Last updated on
by Rajesh Kumar

The best way to attract additional traffic to your website via your WordPress blogs is to increase its speed. When pages don’t load quickly visitors will not stay at your site for long. Yet we tend to disregard this aspect of our sites and don’t concentrate on increasing our websites’ speed. Maybe tuning up the internal speed of our WordPress website is intimidating to us.

It’s a huge problem if your loading time is above 3 seconds or if the size of your page is greater than 2MB. Then you will be losing money by way of server fees and loss in sales. Many tools are available online to identify problems that cause slow loading and poor UX, like PingdomGTmetrixWebPage TestKeyCDN Speed Test, and last but not the least Google PageSpeed Insights.

Learn 15 Ways to Improve Performance of Your WordPress site

Note: Some of these methods require editing WordPress files like .htaccess file etc. There it is recommended to take a complete backup before doing any changes.

Get WP Rocket WordPress Cache Plugin.

#1. Your Images Must be Optimized

Images are generally the chief culprit in a slow-loading website. So ensure that your images are optimized, particularly the ones below 50KB, before you upload the images to your site. Using Photoshop or some other image optimization software or an online tool like tinypng is the best way to get the job done. Save your images with their quality of up to 60 percent. Progressive images must be used for JPG files for this kind of images provide a seamless UX.

#2. Merge Small Inline CSS files — CSS files

Browsers can only handle a limited number of HTTP requests at a given time. When the limit is attained, several files wait as others get downloaded. If you merge your CSS files into a single CSS file, the page moves much faster. If your CSS files are under 2KB then inline them and don’t ask for an additional HTTP request. WordPress has some great plugins like Fast Velocity Minify and Autoptimize which could help you in your merger.

#3. Enable Compression

Compressing at your server your Javascript and CSS files will enable browsers to download the files quicker. If you enable compression, both mobile and desktop users will experience a dramatic increase in your site’s speed.

You can enable Gzip Compression and DEFLATE Compression in WordPress via .htaccess file. You need to paste following code snippets in the .htaccess file of your WordPress.

For Apache Server

Code for Gzip Compression

# BEGIN GZIP COMPRESSION
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
# END GZIP COMPRESSION

Code for DEFLATE Compression

# BEGIN DEFLATE COMPRESSION
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE "application/atom+xml" \
"application/javascript" \
"application/json" \
"application/ld+json" \
"application/manifest+json" \
"application/rdf+xml" \
"application/rss+xml" \
"application/schema+json" \
"application/vnd.geo+json" \
"application/vnd.ms-fontobject" \
"application/x-font-ttf" \
"application/x-javascript" \
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"font/eot" \
"font/opentype" \
"image/bmp" \
"image/svg+xml" \
"image/vnd.microsoft.icon" \
"image/x-icon" \
"text/cache-manifest" \
"text/css" \
"text/html" \
"text/javascript" \
"text/plain" \
"text/vcard" \
"text/vnd.rim.location.xloc" \
"text/vtt" \
"text/x-component" \
"text/x-cross-domain-policy" \
"text/xml"
</IfModule>
# END DEFLATE COMPRESSION

For Nginx Server
Code for Gzip Compression

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;

Alternatively, you can also use W3 Total Cache or WP Super Cache Plugin to enable Gzip Compression on your WordPress site.

#4. Ensure KeepAlive is Enabled

Apache, which is a largely used server for shared hosting at cheaper hosting companies, has a terrific feature called KeepAlive that enables connections to be open for several HTTP requests. So make sure that your host keeps KeepAlive activated. So make sure that KeepAlive is activated at your hosting company. You can enable Keep-Alive in WordPress using .htaccess file. All you need is to use following code in .htaccess file of your WordPress.

Enable Keep-Alive on Apache Server

#START ENABLE KEEP ALIVE
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>
#END ENABLE KEEP ALIVE

On Nginx servers, you won’t require enabling keep-alive.

#5. JavaScript Files Must be Load in Footer

Browsers won’t start to load the content till all Javascript files that are in the page header are downloaded. This problem can be solved easily. Shift the Javascript files from to the footer from the header of the page.

#6. Allow Leveraging Browser Cache

Caching dramatically decreases the loading time of pages which don’t change frequently. When you enable caching at your website, your code won’t generate the page again and again. The user experience vastly improves and your server is able to take on more traffic. In order to leverge browser caching in WordPress via .htaccess file. you need to paste following code in .htaccess file of WordPress.

To Leverage Browser Caching in WordPress via .htaccess file, you need to:

  • Add Expires Headers
  • Add Cache-Control Headers

#1 Add Expires Headers: Paste following code in .htaccess file of your WordPress.

#START EXPIRES CACHING #
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 year"
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/ogg "access plus 1 year"
ExpiresByType video/webm "access plus 1 year"
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType text/x-component "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/font-woff2 "access plus 1 month"
ExpiresDefault "access 1 month"
</IfModule>
#END EXPIRES CACHING #

#2 Add Cache-Control Headers: Paste following code in .htaccess file of your WordPress.

#BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>
#END Cache-Control Headers

#7. Use a Content Delivery Network

Content Delivery Network, Generally known as CDN. A CDN is a content delivery system from the servers located I multiple data centers to the user’s web browsers. When users visits the web page, CDN deliver the data like CSS, images file from the nearest data center, so the webpage can load much faster.

#8. Check for 404 errors

Believe it or not, any missing file causes a 404 HTTP error which will certainly slow the loading time at your site. So always look out for 404 errors when your pages are getting rendered.

#9. Minimize HTTP requests

The greater your HTTP requests, the slower will be your site’s loading time. Your aim must be to lessen the HTTP requisition per page.

#10. Choose the Right File Format for images

Use for your default, JPG which is the fastest and smallest loading kind of file. For images only use PNG with text or if you want a transparent background. GIF files can severely slow your site’s loading time.

#11. Minimize Page Size

It’s always tempting to show plenty of content on your pages, but you must keep the size of your pages at the minimum. This is more important for mobiles. If a new visual does not add value to your site, then avoid including it.

#12. Scale Images

Don’t change image size in HTML directly. Make a thumbnail of the visual in the exact size that you want it on your pages. Use a fresh, resized version of the image and use that.

#13. Leverage Browser Caching

Have in place a caching procedure for all responses to your server and static files like CSS, images, and Javascript so that the browser can decide if it can use a file loaded previously or not.

#14. Monitor Your Database

Database-driven sites like WordPress and every other CMS-based site need to have their database optimized. Full optimization is time-consuming and tricky. So take the help of phpMyAdmin where you will get several optimization options.

#15. Go for Good Hosting Company

Select a hosting company that meets the needs of your site. Keep off hosting companies that have only shared hosting and play host to hundreds of websites/server to maintain minimum fees. The less you pay, the poorer the service you’ll get. Shared hosting is out for you, especially if you have CMS, an E-commerce website, traffic spikes or plenty of traffic. A WordPress hosting that’s WPEngine-managed would be ideal for all WordPress sites.

To sum up, getting your loading time optimized is a winning situation for your likely clients and you. How happy your visitors would be to experience ultra loading! A fast-loading site makes everything hunky-dory and Google gives you higher rankings. Bounce rates go down, users are happy and conversion rates go upwards. Above all, your sales go skywards. So don’t lose cash and traffic. Optimize your loading time right now!

You may also like –

Disclaimer: Some of the links on this blog are affiliate links. If you click through and purchase any product, we may earn a commission at no additional cost to you.

Leave a Comment