Tips to Speed Up WordPress Performance

Hello guys, today I am going to share some tips to speed up WordPress Performance. Blog loading speed is an essential factor in getting more visitors and getting good rank in Google. Most of the time user comes to your blog and left it due to load time. It will ultimately increase the bounce rate on your blog.

Before you make any changes, I advise you to check your blog speed using online services. Once you have done with the pre-test, start modifying for more speed so that you can identify which configuration gives the best performance on your server.

How To Speed Up WordPress:

1. Enabling Gzip compression

It will compress the HTML and CSS and will improve the page loading speed and reduces bandwidth usage.
The setup is different from one server to another so you may have to look on your host instructions section to see how you can enable it on your site.

## BEGIN Enable GZIP Compression ##
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml
SetOutputFilter DEFLATE
</IfModule>
## END Enable GZIP Compression ##

2. Set the Leverage Browser Caching

By setting this, you’ll tell your visitors browsers to remember (caching) some of your website resources that you don’t change so often (like the logo or the CSS/js libraries, posted images, etc.) and only refresh them after a defined period.
To set it, you have to add something like this to your .htaccess file. Add the following code to the .htaccess file.

NOTE: The setup may differ based on what resources you want to include.

## BEGIN Leverage Browser Caching ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## END Leverage Browser Caching ##

3. Set Vary: Accept-Encoding Header

## BEGIN Vary: Accept-Encoding Header ##
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
## END Vary: Accept-Encoding Header ##

4. Optimize images

If your blog has more pictures, it will reduce your server response time as the user have to download all the images each time they access your pages. To reduce the size of the images, you need to compress and optimize your images. It will aid to increase blog loading speed.

There are various plugins available to Compress and optimize images in the WordPress plugin repository. Some of the useful plugins are listed below:

After that put the following code at the bottom of your theme’s functions.php file.

add_filter( 'jpeg_quality', create_function('', 'return 50;' ) );

This code will automatically compress each thumbnail to 50%. You can change value 50 as per your need. For me, 50% gives the best performance. You can use Thumbnails regenerator plugin to regenerate all thumbnails after adding code in functions.php file located in theme’s directory.

5. Lazy Load Images

There are many lazy load plugins available among them; Lazy Load is my favorite one. It uses jQuery.sonar to only load an image when it’s visible in the viewport.

6. Prevent Image Hotlinking

Image hotlinking is a term where someone can load images from your server to websites. In simple language, when someone put your image link on their content then that image loads from your server on their website. It will add unnecessary increase load on your server. So it’s good to prevent image hotlinking.

Add code to your .htaccess file to prevent image hotlinking:

# Start Hotlink protection
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^(http(s)?://)?(www\.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^(http(s)?://)?(www\.)?facebook\.com [NC]
RewriteCond %{HTTP_REFERER} !^(http(s)?://)?(www\.)?google\.*$/.* [NC]
RewriteCond %{HTTP_REFERER} !^(http(s)?://)?(www\.)?pinterest\.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,R,L]

Note: Don’t forget to replace yourdomain.com with yours.

7. Use Lightweight Framework

In simple language, a framework is a package made up of a structure of files and folders of standardized code. It supports the development of websites, as a basis to start building a site.

Driving a WordPress site means, you need a robust framework or a theme. Each theme has a different code, and because of that, they are better than others. Sometimes these themes or frameworks are getting so bulky and thus leads to the bad performance of the site.

There are lots of themes or frameworks available for WordPress. But, while purchasing, make sure the theme is lightweight and also consider their upcoming features.

7. Remove Query Strings from Static Resources

It is a good idea to remove query strings from the static resources as it cause caching issues with some proxy cache and CDN. To remove query strings, add the following code at the bottom of the functions.php file located in theme’s directory.

## BEGIN Remove Query Strings ##
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
## END Remove Query Strings ##

8. Use a cache plugin

Cache plugin generates static files of your content and serves them to the user whenever the user access your pages/posts. It will dramatically reduce server response time. I use WP-Rocket cache plugin on my website.

9. Use Content Delivery Network (CDN)

CDN means a geographically distributed network of proxy servers. It offers spatially related service to users with high availability and high performance.

The main goal behind the designing of CDN networks is to resolve the issue known as Latency. It’s the annoying delay that occurs from the moment you request to load a web page to the moment its content appears onscreen.

This delay occurred by numerous factors, including the physical distance between you and that website’s hosting server. So, to reduce such latency, CDNs are used to minimize that physical distance and improve that rendering speed.

10. Disable Pingbacks and Trackbacks

Pingbacks and trackbacks are WordPress’s core feature that allows you to keep eyes on those who have linked to your content. Though it is a cool feature, it slows down your site, so it’s better to disable it.

You can disable it by unchecking the pingbacks and trackbacks checkbox under the discussion settings.

Disable Trackbacks and Pingbacks
Disable Trackbacks and Pingbacks

This will only stop pingback and trackbacks for new posts. Read our detailed guide to bulk disable pingbacks and trackbacks on old articles.

11. Fix The admin-ajax.php Slow Problem

WordPress uses WP Heartbeat API to communicate between the server and the user’s web browser. The WP Heartbeat API uses admin-ajax.php calls to deliver with a web browser. AJAX calls are not cacheable and may increase WordPress server load time.

You can use Heartbeat Control plugin, which efficiently manages the frequency of the WordPress heartbeat API. Read our detailed guide to reduce admin-ajax server load in WordPress.

12 Choose Reliable Hosting

The main goal of hosting is to allow individuals and organizations to make their website accessible via the World Wide Web.

Choosing a reliable and fast web hosting is essential while driving a website. Although it manages your data 24*7. Generally, cheap things attract people more. But, while choosing the best host, I recommend don’t get excited by hosting providers that offer affordable services. Although, you will get, what you paid for.

To ease the task of choosing the best hosting, we have created a list of best-managed WordPress hosting.

Conclusion

So, this is all about speeding up WordPress performance. You have to make some changes in .htaccess and functions.php file to get excellent performance. Reduce HTTP requests to speed up your WordPress blog. You can use plugins to improve speed, but I would recommend you to use less number of plugins on your WordPress blog.

ALSO READ

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

2 COMMENTS

  1. Where do i have to add leverage browser caching and cache header in .htacess file??
    After the end of wordpress or before the end of wordpress??
    Because i have set it after end of wordpress and it seems not working.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

GET STARTED

Start WordPress Blog: Ultimate Guide For Beginners

Here is our step by step guide for beginners to start a WordPress blog.

Top 6 Best WordPress Theme Frameworks

There are many websites themes which are created by using a framework. Likewise, WordPress Theme frameworks also becoming so popular. The framework allows you...

The Most Essential WordPress Plugins

Here, I have listed some excellent plugins which will surely add more features and new functionality to your WordPress blog.

Tips to Speed Up WordPress Performance

Here, I am sharing some tips to speed up WordPress performance. All you need to modify .htaccess file on your server and add some plugins.

The Ultimate Guide to Harden WordPress Security

Learn how to improve WordPress security. Here are some basic security concepts that will help you to harden WordPress security.

How to Setup CloudFlare Free SSL for WordPress Blog

Google has announced that they will count HTTPS as a ranking factor which means if you using HTTPS you will get a higher position...

DEALS

MyThemeShop

MyThemeShop builds the fastest WordPress themes on the market!

POPULAR NOW

How to Remove jQuery Migrate in WordPress?

jQuery Migrate greatly simplifies the process of moving older jQuery code to a higher jQuery version by identifying deprecated features. It then restores deprecated...

Get almost 100% PageSpeed on Newspaper theme

The newspaper theme is the most popular premium theme for a self-hosted WordPress blog. The theme is developed by team tagDiv. You...

How to Delete Multiple Images in WordPress Media Gallery

Hey, guys today one of my friends asked me a question, How can I delete Multiple Images in WordPress? I replied, "It's very simple." Yeah,...

Xperia Home Launcher: Install on any Android Device (No Root)

Hey, guys today through this tutorial you are going to learn how to install Xperia Home Launcher on any Android device without any root. Also...

Tips to Speed Up WordPress Performance

Here, I am sharing some tips to speed up WordPress performance. All you need to modify .htaccess file on your server and add some plugins.

How to Display Featured Image Before or After Entry Title in Genesis

Learn how to add featured image to a single post or a page in Genesis child themes. You can set it to display featured...