Steps to Make WordPress Page Load Speeds Faster – GTMetrix

  • October 19, 2017
  • MMO
1 Comment

Everyone wants better load time for their WordPress website. Recently I have been researching and researching ways to make my WordPress site faster. Yup, you guessed it, I am trying to get page load times much faster for MMOWITHSEO. I have been using GTMetrix.com to get more information.

GTMetrix

GTMetrix is one of the tools that I have found very helpful and use a ton for each of my websites. It gives me detailed reports about my site’s performance and it is a FREE tool you can use to analyze your page’s speed.

Follow my simple instructions and you should be able to reduce your load time and get your PageSpeed Score higher than it was. My PageSpeed Score right now while writing this, is a C 75%, YSlow Score is also a C 74%.

As you can see, it needs improvement. So I am going to keep on the PageSpeed tab and focus on anything lower than a B rating.

Serve Scaled Images

This basically means you are already resizing these images in your HTML or CSS, so you might as well make them the actual size you are scaling them to with code. I am going to go into the media library and find each one of these images that are on my WordPress site and scale them down to the recommended size.

Now if you see links that are not on your website you do not have much of an option. Although, if you know what the image is you could download it to your site and then scale it and change the link so you are getting it from your own website. I have that stupid WordPress Gravatar image being scaled in HTML, I will check later on to see if this is something I can fix easily. So, go scale the ones you can, right now! I have 3 of them to do.

I just scaled those 3 images to the suggested size, now let’s rerun GTMetrix and see if that helped. If you are on a CDN put it in development mode and flush your cache before you rerun.

RESULTS

Just changing those 3 image sizes I increased my PageSpeed Score to A (90%)!!! My YSlow Score is still at C (76%), so let’s see what else we can do.

Avoid Bad Requests

Next up on my list, avoiding bad requests. For some reason I have some requests returning 404/410 responses and need to fix the broken links, or remove the references. Mine are mostly related to, what seem to be JS files.

I am thinking this problem is only on my site because I was defering parsing Javascript in my WordPress site. This is the code I used.

// Defer Javascripts
// Defer jQuery Parsing using the HTML5 defer property
if (!(is_admin() )) {
    function defer_parsing_of_js ( $url ) {
        if ( FALSE === strpos( $url, ‘.js’ ) ) return $url;
        if ( strpos( $url, ‘jquery.js’ ) ) return $url;
        // return “$url’ defer “;
        return “$url’ defer onload='”;
    }
    add_filter( ‘clean_url’, ‘defer_parsing_of_js’, 11, 1 );
}
I added this code to my functions.php file. Just scroll all the way to the bottom and add the code and your page load time will really improve. The idea here is to load only what is required by the reader first, which is the content. So you need to defer javascript so that the content is loaded first and then other secondary items can follow. Just be careful using the code, if it does not work for your or breaks your site – don’t use it.
I added it to my functions.php – let’s see if that made any changes to my GTMetrix score, good, bad or otherwise. Remember to flush your cache.
**That code actually broke my site and returned a HTTP500 error, I do use that code on another site and it has no issues, must be a conflict with the theme** The other site with MiniFigClub.com
Let’s move on to the next one.

Inline Small CSS

My score here is B (83) so not horrible. Basically using inlined CSS it reduces the amount of files the browser has to download prior to displaying your web page.

I use Autoptimize WordPress Plugin. It can aggregate, minify and cache scripts and styles. It’s free and it works well.

Just go to Settings > Autoptimize and hit the checkbox by HTML, JavaScript & CSS. I use Cloudflare so I don’t put in anything for the CDN Base URL.

Leverage Browser Caching

Right now, I am sitting at a B (87) for leverage browser caching and there is nothing I can do about it. The reason I can’t to anything about it is because the URLs in my list are external. Like Google Analytics, I cannot set their cache time so when your browser loads it still has to go find those scripts. However if you have a bunch of files in there, one way to leverage browser caching is to update your .htaccess file. Here is a simple code to be added to the top of your .htaccess file that caches jpg to js.

EXPIRES 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 text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
</IfModule>
## EXPIRES CACHING ##

Minify CSS

I haven’t re-tested my site for awhile but the Autoptimize plugin should have taken care of Minifying my CSS and other scripts.. so lets re-run at this point. Remember to flush your cache.

My PageSpeed Score went to B(81%) and my YSlow Score stayed the same. Let’s take a look at the Yslow tab now.

YSlow

Make Fewer HTTP Requests

This tells me I have 23 external Javascript scripts and I should try combining them into one as well as 19 external stylesheets and I should combined those into one as well to reduce the number of HTTP requests.

On WordPress Plugin I have heard good things about is Better WordPress Minify, I am going to download that and see if that can help improve. This cut my requests down to 50!

That helped! PageSpeed Score is at A(92%) and YSlow Score C(79%) so I am going to check out the YSlow tab and see what else I can improve on.

My Add Expires Headers was a zero – that is why my Yslow Score is so low. Although, remember I turned off my CDN and put it into development mode so I could see changes right away? Yep, just needed to turn that back on and re-test with GTMetrix.

Perfect, I turned my CDN on and bam! PageSpeed Score A (95%) and YSlow Score B (86%)!

Conclusion

I jumped my PageSpeed Score up 20% and my YSlow Score up 12% in a matter of a few clicks! It really is that easy you just need to do a little research. Your site will load faster, you will have better Google Rankings because of that too! Your readers will be very happy with your site speed too!

So do you know of other tips and tricks to speed up your WordPress site? Any .htaccess tricks? functions.php code to speed things along? What are you doing with your website to make it faster?

The speed of your website is very important. If you are serious about creating a blog to produce actual income you should consider hosting with WP Engine – they are in the top spot and where everyone who’s who hosts their WordPress sites. If you want to sign up, I can give you up to 4 months free on any annual subscription!

Coupon Code: wpe20off
Ends: October 31st, 2017
Link: WP Engine 4 Months Free

Professional Front-End and Wordpress Developmer.




More from our blog

1 Comment
  1. Reply

    I’m just writing to make you be aware of of the really good discovery my girl obtained browsing your web site. She even learned a lot of things, with the inclusion of how it is like to have an amazing teaching mindset to get others completely know just exactly specified hard to do subject areas. You truly surpassed our expected results. I appreciate you for coming up with these practical, dependable, educational and as well as cool thoughts on your topic to Mary.

Leave a Comment