

Is your WordPress website slow? If it is, you should take steps to optimize it.

Shaving extra milliseconds from your site’s loading time can have a great impact on your traffic and search engine visibility.

What causes WordPress to load slowly?

WordPress is a great platform for clean and well-designed code, but it’s not perfect. There is a massive list of themes and plugins, but they don’t all offer good performance.

Slow themes and plugins can make your website sluggish. Combine that with a crappy web host, and you’re in big trouble.

If you’ve been asking yourself questions, like “Why is my WordPress site so slow?” or “How can I speed up my WordPress site?” , please read and carefully follow this guide.

It describes the easiest ways to speed up your WordPress site. After reading it, if you have more questions, just drop them in the comments section.

Why is speed so crucial in today’s web environment?

Google now considers site speed a deciding factor in your search result ranking. If your site is slow, get ready to lose a huge number of visitors.

Check out this amazing info-graphic from Kissmetrics:

How to Speed Up Your WordPress Site?

Before starting, please check your current website performance with Pingdom Tools and GTmetrix. Compare this result after applying tips from this guide.

I guarantee you this tip helps to boost your website speed.

#1. Choose a Good Webhost

You want to optimize your WordPress site for speed but how you improve a site where your web server makes things sluggish and slower.

I Know, When you start as a newbie, you fascinated by Unlimited Page views or Bandwidth type web hosting advertise by pro blogger. As a newbie, it’s reasonable to buy this types of the host because they offer cheap plan affordable by any new blogger.

But this unlimited thing comes with costs, when you or another user who hosts on the same server, get traffic to your blog its load slower like a turtle. If blogs receive massive traffic then in many cases your website down or they send you to email about upgrading your site to a higher plan.

They cover their expenses by hosting thousands of website on the same server and all accessible through the same IP. Means, if any site flagged in search engines than it hurts your site SEO too. Check this article, 👉 The Truth About Unlimited Hosting.

Before purchasing a web host, please go to google and search for a review. Check communities like WebHostingTalk and please don’t trap yourself in Unlimited Hosting Plan. Check this article, 👉 Beware of “Web Hosting Review” and “Top 10 Web Hosts” Sites

I divide WordPress Hosting in three different categories. For more details, please check, 👉 How To Choose Best WordPress Hosting and Save Money

a. Affordable WordPress Hosting:

If you are looking for affordable WordPress optimize hosting, check SiteGround or GreenGeeks or A2 WordPress Hosting.

They Offer managed WordPress hosting with latest features like PHP7, HTTP/2, SSD, Free SSL Certificates and tons of other features starting from 3.95$ / Month.

GreenGeeks or SiteGround have similar features as compare to WPEngine in affordable price range.

Finally found a better Unlimited Hosting company than Bluehost, GreenGeeks. GreenGeeks provides you SSD space, low websites on server (means faster speed) and 300% Powered by Renewable Energy.

But, if you still want to use unlimited type WordPress hosting, choose BlueHost. If you are from India and want to buy hosting from BlueHost, choose US Hosting. Don’t buy Indian BlueHost hosting account.

Please don’t use any EIG owned hosting provider, bluehost owned by EIG. Check 👉 Why you should avoid Endurance International Group (EIG)

b. Premium WordPress Hosting:

Not Every business is same, that’s why some business or high traffic getting website need premium WordPress hosting. Choose Kinsta or WPEngine for your big projects.

👉 WPXhosting is a fastest Managed WordPress hosting provider.

👉 Kinsta is a fast Managed WordPress hosting powered by Google Cloud.

👉 A WPEngine plan starts at 35$ / Month, and they are a leader in WordPress Managed Hosting.

c. Geeky [DIY] WordPress Hosting:

If you are a tech-savvy blogger or want more power as compared to a shared hosting environment with total control on your server.

Choose any Virtual Private Server provider.

In this type of web hosting, everything managed by yourself or operated by a provider with extra cost.

If you go with this, then choose unmanaged VPS from Subnet Labs[currently host this blog] or Digital Oceans.

But, Masood, How can I manage it myself?

Don’t worry, with the help of Webinoly or CyberPanel or Centmin Mod; you can set up the world class WordPress optimized environment in minutes.

I am using Webinoly to setup fully optimized WordPress stack for BLOGGYAANI.

#2. Use Solid WordPress Theme/Framework

Themes play a major role in WordPress because either it attracts your visitor or distracts them. That’s why you see many themes in the WordPress ecosystem. As a new blogger, everyone attracts to free WordPress themes or some shiny premium WordPress theme which has endless post display setting and blah blah blah.

Many free themes add lots of unnecessary code on your WordPress site in the name of better user experience, or they won’t follow WordPress themes guide. The result, your website loads slower due to many calls to your server resources. This condition is also applied to many premium themes. For more sells, they add lots of function in one theme which is not required by your website, and these features make your site loads slower.

Default WordPress themes are always speedy and well coded and easy to customize, but I advise you to buy some premium themes or hire a coder.

This blog use Authority Theme from MyThemeShop, its optimized by six figure blogger Mathew Woodward.

Check my review here, Authority Theme Review: Make Your Money Blog Now.

Currently I use GeneratePress from GeneratePress.

If you want clean and light weight theme then choose GeneratePress, or MyThemeShop, or for making fancy website without compromising your speed then choose Elegant Themes. Both theme provider provides wide range of themes which fits in any niche.

#3. Install Good Caching Plugin

The second most important part of this guide after choosing a good web host is installing a good caching plugin. After installing any active caching plugin your website, you can tell the difference between a page with caching or without caching plugin.

Caching plugins make a copy of your site in a separate folder in entirely static form or try to reduce calls to your blog server, and when a user arrives at your site then instead of showing original page plugin show them a cache version of a page. It reduces database calls, no of PHP requests and no of HTTP requests(combining many files into one).

WPRocket is my favorite caching plugin and use it on all my blogs. Before using WPRocket I use W3 Total Cache with memcached enabled and my website load in 300ms, yes 300ms but after WPRocket its loads under 200ms with same page size(page size: 299KB).

ATHEMES compares 9 popular WordPress caching plugin and find WPRocket faster than W3 Total Cache or WP Super Cache.

Check WP Super Cache or PageSpeed Ninja, both are great plugin and newbie friendly.

👉 Check 8 Top Best Free Plugins to Make WordPress Faster.

I am not using WPRocket anymore for my blogs, instead of WPRocket I use CloudFlare full cache, Rocket Loader™ with Autoptimize. It’s give me a better results as compared to WPRocket with CloudFlare full cache.

After WPRocket 3.0 update, everything is changed and now its outperformed above stack.

#4. Use a Content Delivery Network(CDN)

CDN used for offloading your static resources from your main server, like CSS, Javascript, Images, and Files. This offloading process makes your website loading faster at the user end and your primary server free from this task.

CDN providers cache your static contents in their data centers, across all over the globe. When a user requests this resources than its loads from the data center which is closer to user location.

If your server host in New York and a visitor comes from India, then CDN provider loads static files from the Asian data center.

There are many CDN providers available in web market, but KeyCDN is most affordable CDN provider. KeyCDN provides free SSL and HTTP2 support.

If you are new blogger and you are unable to bear the cost of these premium CDN’s then choose CloudFlare, it’s acts as a CDN and also provide security for your blog. Like, block bad bots and visitors to accessing your site and makes your site faster.

Don’t want to use Cloudflare in front of your websites and still wish to offload some assets to CDN without spending a dime on CDN.

👉 Check commonWP, commonWP is a plugin that enables usage of free, public CDN (jsDelivr) for open source JavaScript and CSS files, for more details check, 👉 New commonWP Plugin Enables WordPress Sites to Use the Free jsDelivr CDN.

I am using CloudFlare free tier[only DNS hosting] + WPRocket at BLOGGYAANI.

#5. Enable Gzip Compression



Always served gzip version of website to your visitor, because its compress your overall web-page size and makes it faster.

Check Gzip Compression of your site with this tool.

If you host your website with cpanel, enable gzip from panel or you can use plugin like Check and Enable GZIP compression, W3 Total Cache, WP Super Cache or WPRocket.

Gzip also enable via .htaccess , for Apache

## BEGIN : Enable GZIP Compression (compress text, html, javascript, css, xml and so on) ## 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 ## END : Enable GZIP Compression ##

For Nginx,

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; # Disable for IE < 6 because there are some known problems gzip_disable "MSIE [1-6].(?!.*SV1)"; # Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6 gzip_vary on;

🛑Please take a full backup of your website before playing with .htaccess file.🛑

#6. Add an Expires header

When someone visits your site, visitor browser downloads all files from your server to visitor device and render your website. Expires header set a expire time for your static content.

Mean If you enable expire header for static resources then at the second visit of the same visitor, browser, not downloads same content and display resources from the first visit if it does not expire.

Add these code in .htacess to enable expire header in WordPress.

## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 month" ExpiresByType image/jpeg "access 1 month" ExpiresByType image/gif "access 1 month" ExpiresByType image/png "access 1 month" ExpiresByType text/css "access 14 days" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 14 days" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 14 days" ## EXPIRES CACHING ##

👉 Above numbers are changeable, change according to your needs.

#7. Use a Minified Resources

Websites use CSS and JS files to beautify, and these files are many in quantity. Every plugin or themes you add to your blog adds some CSS or JS files.

If browsers communicate with your websites with HTTP v1 Protocol, then they download only four files in a parallel manner. Imagine, your blog has 20+ CSS and JS files. How much time browsers spent to connect your hosts and fetch them to display your website to Visitor?

For this problem, you can use plugins like Autoptimize or WPRocket. They minify and combine your static resources in one or two files, then sends these files to the visitor. These help to speed up the overall process.

#8. Optimize Your Images

Images are heaviest and necessary elements of any web page; It increases engagement on your page. Due to heavy in storage, its loads your website slower, and sometimes your site still loading and visitor leaves your site. For this, I have some easy solution for you.

First, you must specify image dimension thumbnail, medium, and large sized images. I always choose a medium and large size up to 2000 * 2000. Why?

Every theme comes with own image size and that time medium, and large setting creates an image which is not used by posts. Then just make it higher than your possible image size.

Second, reduce your uploaded image size, don’t worry you have two great free plugin for this work.

I test both plugins on my personal website, where both compress 7mb image folder in 3.5mb. Imagify perfect for JPG while ShortPixel great for PNG. Both are free for some quotas and newbie it’s sufficient. Install WordPress plugin for any of plugin and start compressing your image without leaving your WordPress dashboard.

#9. Lazy Load your Images

Lazy Load helps you to save bandwidth and speed up WordPress site. How?

Lazy Load displays images, videos or iframes to a visitor when it’s visible. With the help of a lazyload, you can reduce HTTP requests to your server; you save your resources by not showing images to a visitor who not read your article or not scrolls down.

You can use WPRocket or Rocket Lazy Load or Flying Images to add lazy loading fuctionality in your blogs.

At BLOGGYAANI, I am using Flying Images to lazy load images and reduce load time of the website.

#10: Optimize Your Database

You can optimize your database through plugin or by PHPMyAdmin, plugin like WP Sweep or WP Optimize. WP Sweep is better than WP Optimize according to my experience. Or use WPRocket for database optimization.

These plugins delete pending spam comment(if you use default WordPress Comments), Post revision, Post draft and many things. WordPress works with database and optimizing database gives your website huge boost in WP speed up process.

🛑Please back up your website or publish your saved draft before making total cleanup because of it not reversible in many cases.🛑

#11. Only Install Well Coded Plugin

In the WordPress plugin directory, you can find thousands of plugin, and after analyzing their code, you find many plugins are not well coded, and some won’t follow the standard. Always install a plugin which updates from time to time.

There is one problem, How you could find a better plugin for the same job.

First check plugin rating, if it’s three stars then try to find an alternative. But some plugin won’t get any star and still update to WordPress version, check those plugin on localhost or in a sandbox.

Why you won’t install a poorly coded plugin?

Because they insert lots of inappropriate hooks on your website, and it’s slow down your site.

Second, after installing your desired plugin, check performance and impact of plugin on your website using P3 Profiler. It’s not 100% accurate, but still, you find a problem on your website.

#12: Perform Routine Maintenance on Your Site

WordPress plugins are an easy target for hackers. Why?

Many times we are not paying attention to our blog and not update it time to time, when you check the internet you find main reason for hacked WordPress website is not update plugins.

Always uninstall and delete plugins which are not required, because it’s slow down your site by calling not needed resources.

#13: Optimize your homepage to load quickly

Always optimize your blog front page, change default settings of your theme. Don’t display too many posts or infinite scrolling pagination.

Keep this point in your mind while optimizing your front page,

Display summery instead of full post Reduce the amount of post in front page(Mine is 4-5) Remove sharing widgets from front page Remove unnecessary widgets from your front page Don’t display too much ads, or won’t display it keep it simple

#14: Limit and Delete Old Post Revisions

Do you require 10s of posts revision for your published posts? I think it’s not necessary.

You can use WP-Sweep or Revision Control to delete posts revisions from your WordPress database and make it smaller and faster.

But, sometimes while writing posts we need some revision if things goes wrong, add this code in your wp-config.php before /** Absolute path to the WordPress directory. */ ,

define('AUTOSAVE_INTERVAL', 600); define('WP_POST_REVISIONS', 3);

You can change auto post time 600 to your desired time, time in seconds and change post revision 3 to whatever you want but keep it below 5. Otherwise no meaning for this code.

#15: Turn off pingbacks and trackbacks

WordPress uses pingbacks and trackbacks for interacting other WordPress blogs.

When someone mentions your blog or site in their posts, its notify your website and most time this is used for getting a backlink. This could hurt your backlink profiles and also its makes loads on your blog database.

Turn off Allow link notifications from other blogs (pingbacks and trackbacks) on new articles in your Discussion Setting .



If you turn off this setting, it does not destroy your profile and also helps to save database from junks. Check How to Deal with Trackbacks and Pingbacks in WordPress for further explanations.

Add below code in your function.php or use Code Snippets plugin for avoiding any self-ping from your own post.

//Disable Self-Pingbacks function bloggyaani_disable_self_pingbacks( &$links ) { foreach ( $links as $l => $link ) if ( 0 === strpos( $link, get_option( 'home' ) ) ) unset($links[$l]); } add_action( 'pre_ping', 'bloggyaani_disable_self_pingbacks' );

Comments are an essential part of any posts, comments promote and give freedom of speech to visitor and readers of blog posts. Comments help you in SEO when Google see engagement on the page, then its consider as a vote of trust.

But, some people use comments for spamming or link back to their website. Link back to commentator site encourage a visitor to leave a comment on your posts, but again we deal with lots of comments linking to spam sites.

You can activate Akismet plugin, it helps to catch spam comments, but all spam comments go into spam queue and make database size larger.

I use WordPress Zero Spam, Its never show any spam comments in spam queue. You should use Zero Spam, its also protect your contact forms.

You can disable URL field from comment form using code.

/* Remove URL from WordPress Comment forms */ function bloggyaani_remove_website_field($fields) { unset($fields['url']); return $fields; } add_filter('comment_form_default_fields', 'bloggyaani_remove_website_field', 9999);

or you can strip comment author website clickable link using the code.

// Disable comments author links if( !function_exists("disable_comment_author_links")){ function disable_comment_author_links( $author_link ){ return strip_tags( $author_link ); } add_filter( 'get_comment_author_link', 'disable_comment_author_links' ); }

#17: Remove Query String

Whenever you run your website through website auditor tools, you found one common advice in all of them. Remove Query Strings from your resources. What is this?

Query string are the file numbers attached with your CSS and JS files like this https://domain.com/file.min.css?ver=5.0.2. Some servers are unable to cache this, so removing the Query Strings helps to make caching more efficient.

You can use function.php or free Code Snippets to add following code in your WordPress site.

function remove_query_strings() { if(!is_admin()) { add_filter('script_loader_src', 'remove_query_strings_split', 15); add_filter('style_loader_src', 'remove_query_strings_split', 15); } } function remove_query_strings_split($src){ $output = preg_split("/(&ver|\?ver)/", $src); return $output[0]; } add_action('init', 'remove_query_strings')

Or:

You can use WPRocket to remove query strings and improve caching functionalities of your WordPress websites.



#18: Use Google CDN for JQuery

Almost every WordPress theme calls JQuery to animate things and its loads from your server when a visitor comes to your website. JQuery file load from a server and its waste your 33KB bandwidth every time. Why?

Because Google host latest JQuery on their servers and your server never beat Google. If you use Google JQuery library, then it’s a chance this file already download on your visitor computer. If it’s present in visitor computer, then browser calls this file from the cache and not download it again. It saves bandwidth and time. Or use a 👉 commonWP plugin to offload your entire WordPress common file to JsDelivr CDN.

You can add this via Code Snippets or via function.php file,

add_action( 'wp_enqueue_scripts', 'register_jquery' ); function register_jquery() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', ( 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js' ), false, null, true ); wp_enqueue_script( 'jquery' ); }

#19: Remove Google Web Font

Typography helps in reading and make blog beautiful. It makes a blog more appealing to a visitor. That’s why every theme developer adds in themes.

These fonts add 10 to 50KB extra weight in your CSS and also add 3 to 6 HTTP requests on your blog.

The visitor wants a clean and fast loading blog with full of information; you can use Georgia, Thoma or Verdana font on your blog.

Use Remove Google Fonts References to remove Google fonts from your themes.

#20: Replace PHP with static HTML, When necessary

WordPress wrote in PHP language; it makes your site efficient, and you are free from entering the same information multiple times. But, calling resources using PHP increases server load. You should replace PHP content on your theme with HTML if it’s possible. It increases your blog speed.

🛑 Please backup your blog before doing this steps.🛑

For example, in many themes, functions like these are executed for each page load:

<title><?php bloginfo('name'); ?> - <?php bloginfo('description');?></title> <link rel="shorcut icon" type="image/x-ico" href="<?php bloginfo('template_url'); ?>/favicon.jpg" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('stylesheet_url'); ?>"/> <link rel="stylesheet" type="text/css" media="print" href="<?php bloginfo('template_url'); ?>/print.css" /> <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php bloginfo('rss_url'); ?>" />

And when you replace the PHP functions with simple HTML, it looks like this:

<title>BLOGGYAANI - Your Ultimate Guide to Blogging Success</title> <link rel="shorcut icon" type="image/x-ico" href="https://bloggyaani.com/wp-content/uploads/2016/04/favicon.jpg" /> <link rel="stylesheet" type="text/css" media="screen" href="https://bloggyaani.com/wp-content/themes/bloggyaani/style.css"/> <link rel="stylesheet" type="text/css" media="print" href="https://bloggyaani.com/wp-content/themes/bloggyaani/print.css" /> <link rel="alternate" type="application/rss+xml" title="RSS" href="https://bloggyaani.com/feed/rss/" />

#21: Disable hotlinking of images

When someone hotlink your blog image, its make your website load slower. To prevent your bandwidth stolen from your website, add this code in your .htaccess file or use this website to create custom .htaccess for your need.

## 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] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/yourblogname [NC] RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

#22: Host your videos externally

If you are a video blogger, then this is for you.

Videos require lots of bandwidths to serve, and for different devices, you need a different size for video, and this is costing you lots of bandwidth and storage space.

Use Youtube or Vimeo for hosting your videos.

They serve videos according to visitor device size and also offer in low and high resolution.

#23: Lazy Load your Videos

YouTube videos help to drive traffic, but it adds additional 500Kb to 1Mb on that page.

Imagine, if you embed YouTube or any type of external videos code on your homepage or on any page then you probably hit by Google slow loading website penalty.

How to avoid this?

Use LazyLoading techniques for Videos, There are many plugins available but I use A Better Method for Embedding YouTube Videos on your Website.

You can download plugin version of above solutions from here, LightTube. It place one yt button in your WordPress Code Editor.

👆 The video above is embedded using the same on-demand technique 👆

Or,

You can use Lazy Load for Videos

Conclusion:

Site speed is now the critical factor in search engine positioning algorithm. You can lose your potential visitor due to the slow pace of a website. Internet users close site if it’s not loaded in three seconds and shift from desktop to the internet-enabled devices means if you are not fast then you’re not going to see.

This post helps you to make your WordPress blog or website faster, and I test all these tips on various sites.

Check BLOGGYAANI speed on Pingdom Tools,



I think after reading and applying techniques at your site, you can make your WordPress website faster, aren’t you?

What other ways do you recommend to speed up WordPress sites and improve load times of WordPress websites?

This blog post updates immediately after I find any new ways to Speed UP WordPress Sites.

Thanks for reading! Please share this article if you enjoyed it.