How optimize speed of wordpress

Speed of sites on wordpress is one of the weak side of wordpress, because default wordpress cache system is very simple and not effective. But power of wordpress is in it’s community and number of awesome free plugins. Today I will tell you how you can get A grade on gtmetrix, google page speed, increase your page speed. These rules are working great in 95% of cases.

First of all, I want to talk about speed analytic. Many people uses google page speed test, but I don’t like it for one reason, because of this

google-page

Normally, on all standarts, css must load in head tags, js – in footer. This allows to render site correct, without shaking and jumping. But google doesn’t think so and recommend to load css inside content or asynchronously. Second way is hard to do on wordpress, and loading css inside content is not valid and not correct, so, I absolutely don’t understand this rule, which usually grabs near 10-15 points.

Update 1.

Render-blocking Javascript in above-the-fold content

You can try plugin Async Javascript to eliminate Render-blocking Javascript in above-the-fold content. Other possible plugin is WP Deferred JavaScripts

Note, this can cause problems with your scripts. So, use carefully.

So, I recommend to test site on gtmetrix.com which compares score between 2 tests.

Also, note, score – is just score, you should think about speed of site, not just score.

Let’s begin


First of all, I want to tell you that if you have slow hosting you can’t get good speed for your site even you are a master of caching websites. How to check your hosting? I want to give you advice. Go to your admin panel of wordpress and activate default theme and deactivate all plugins. If it loads not quickly – you need to change your hosting.

Also, sometimes, it’s important to have server localization close to your destination. For example, if site is for USA, make sure that your server is located near USA (or in USA). Because I have some cases, when hosting is good, but because of it’s location, it works very slow in my country.

Currently, I tried most of popular hostings, like Siteground, BlueHost, HostGator, WPEngine. All are ok, but I like Siteground more because it has inner cache system even for shared hosting + Memcache. I think it’s only one hosting which allows memcache functions on simple shared packages.

Ok, you have good hosting. Let’s do some improvements.

First things that you need to do – check your external scripts. If you use many ADS on page + social buttons + external scripts – you can’t get A grade, because you can’t cache external scripts and you will lose many points. But, even if you don’t get A grade, don’t upset. The most important thing – is your site speed. It must be under 4 second. 2-3 second – good, 1 second – awesome. Even if you get C grade, but your site loads under 1 second – this is ok.

Cache plugins for wordpress

I think I tried near 10 different cache plugins for wordpress. Some of them were awesome in past, but now is outdated. Currently, I think there are two good plugins which I used on sites. Wp Super cache and W3 Total Cache. I can recommend Wp super cache, because it’s much easier. W3 Total Cache – is all in one solution, but it’s very hard for novices to configure it correct + sometimes it has many incompatibilities with many plugins.  After installing Wp super cache – just enable caching. Usually, all things work by default.

Next things that you need to do – css and js minifying. If you use W3 Total Cache, you can just enable minifying. There is no minify function in WP super cache, so you need to use another plugin. I tried many of them and find that the best is Better WordPress Minify which is working great with super cache plugin. Previously, I used Autoptimize, but it’s not compatible with many other plugins, including Buddypress, MDTF.

After installation, go to settings and enable all checkboxes. Check your site, especially different ajax functions. Sometimes, there are some incompatibilities. But, usually you can fix them. For this, go to settings and enable advanced settings

85

and try to check Force JavaScript in <head> and Look for styles only in <head>

Also, sometimes plugin stores files as separate files. After 1 week of using you can have near 100 000 files and this can be more than your disc limit. So, click on advanced settings and see at the end Cached styles and scripts. If you have too much files here, you need to save and empty cache (do this each week).

Leverage browser caching

Next step is setting correct expiration data for static resources. For this, you need to edit file .htaccess

If you have enabled Seo by Yoast plugin, you can edit this file without ftp. Go to Seo – Tools – File Editor

In most cases you have some code in .htaccess which allows wordpress use permalinks. Left it as is and add such code after

Image optimization

Usually I make two things. First – EWWW Image Optimizer plugin which reduces your image size. It works on all new uploads, but also you can optimize all existing images. For this, go to Settings – EWWW Image Optimizer. At the top of page you will find link Bulk Optimize. Click on it and then begin Optimize Media Library and Optimize Everything Else

Second plugin for images – BJ Lazy load. It allows to load images only when user reach them in screen. Usually, works ok with default settings. Note, some themes already have lazy load option for images, so, try to use inner theme functions.

Wpsoul’s theme buyers. Check theme option – global enable/disable to enable lazy loading for thumbnails in theme

Also, you can try to configure CDN for images. But note, that in this case you can’t optimize them.

I made all changes, but still have bad points

Usually, this is because of external scripts. All external sources can’t be cached and don’t have expiration date on your server. So, try to avoid using many external scripts.

First of all, check your fonts. Many theme uses google fonts. But I see that many users add tons of google fonts on site. Use only 1, maximum 2 custom fonts on site.

Second – icon fonts. It will be better to upload icon font on your site and use it from your server than external source.

Third – most common. Too many plugins. I see this very often on client’s websites. Many people install plugin just because they read that this is must have plugins. For example, most of sites have jetpack with all enabled modules.

Remember – use only those plugins which you know. Disable all plugins which you don’t understand.

Update 2

Some page speed test tool will take some points when your static scripts and css styles have query strings. Example, site.com/wp-content/themes/theme/style.css?ver=3.1 The problem is that this is default behavior of wordpress. You can delete this strings with plugin

Conclusion

These are the main things that you can do with site. Usually, after all steps you will get A grade. Of course, there are many possible reasons why you can’t get it and they are individual for each site. If you want – you can hire me to check your settings and optimize your site. Check contacts to send me email

These methods are good for most hostings, shared and VPS. If you have high load project, you maybe need some another methods with server optimization. For example, setting nginx + memcache.

 

 

How optimize speed of wordpress
4.14 (82.86%) 14 votes

Want to get unique wordpress tips?

We won't rent or sell or spam your email. We promise!

Tags:

Leave a Reply

8 Comments on "How optimize speed of wordpress"

Notify of
avatar
Sort by:   newest | oldest | most voted
trackback

[…] Also, we have great article how to increase speed of site with cache functions […]

Chaz
Guest

Great post. Best edit to .htaccess I have found on the net.

Divaksh Jain
Guest

I can’t find option for the fontawesome, it is not there. Is there anything wrong with me? O.o

Rohit Singh
Guest

Thanks for this wonderful post I think that we must take steps to make our wordpress blog fast to load as possible because Google now considers blog speed as one of the major ranking factor.

Shahrukh
Guest

Awesome guide. I agree with you about the Google’s PageSpeed and I think GTmetrix is good enough, for me at least.

tongercore
Guest

What about AMP, does Rehub supports the mobile standard of AMP?

wpDiscuz