• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Wordpress Website Page Speed Optimization

Feb 25, 2019
203
23
18
Hey, I built a website on wordpress but page load speed is pretty bad on GT Metrix & Google Page Insights.


Can someone help me out? I tried W3 Cache, WP-Rocket, etc caching plugins still no effect.


Any help would be appreciated :) Thanks
 
Limited use of 3rd source code. I think the main problem is here!
 
1.) Turn off cache (you will turn it on later)

2.) Install Asset Cleanup Pro plugin (you will use to this to unload the assets (JS, CSS, Plugins) that are slowing down your pages) Please read the plugins documentation.


3.) Run Google page speed on homepage

4.) Under 'opportunities' of the Google Page Speed results there will be a list of Render Blocking Resources

5.) Go to your websites homepage and click Edit Page (with regular WP page editor not a pagebuilder)

6.) Under neath the page body there will be a 'Fetch all JS and CSS' button. Click it and let Asset Cleanup fetch all the resources associated with the page

7.) Go back to Google Page speed Render Blocking Resource list and copy all the links to a notepad/spreadsheet

8.) Go back to the WP page editor you have open and Find the first link in the Fetched Resource list

9.) Begin Moving all the Resource blocking resources from the Head * to Body (there is a setting for every link, all you have to do is change the setting). (Be aware, a few critical CSS resources should stay in the Head so visitors don't see a flash of unstyled content. You will need to be aware of this when moving some CSS files to the Body)

10.) Unload all JS and CSS that is not being used for that page (Google page speed lists what JS and CSS it THINKS are not in use, but you must test what resources REALLY can be unloaded for your sites functionalities. Google's list is not 100% accurate. More like 40% accurate)

11.) In asset cleanup plugin settings add plugin unload rules.

12.) Don't use Asset cleanup cache settings if you already have a cache plugin. Only use it for unloading assets.

13.) Repeat on all important pages are post types. Use Site wide unload rules and regex rules to make this easier across your site.

14.) Turn back on cache (I suggest Litespeed Cache, but I haven't tested others tbh)

15.) Minify and combine JS (Test thoroughly with this, you will almost certainly need to add exclusion rules to this.)

There will be a lot of testing, so make yourself a spreadsheet and take notes of the speeds and what can/cannot be unloaded. (Asset cleanup had a noted section you can add to each JS/CSS asset too.) Don't get discouraged if you unload a bunch of resources that break or mess up your site. Just slow down and retrace your steps and reload them and take better care to find out what they do. Know this will make your site faster, and doing it correctly the first time is the best way to go. This is the only way I personally know how to make a WordPress site faster without knowing how to code OR paying a developer. (Moving to VPS is also a good idea, too)

16.) Add your site to cloudflare

15.) Turn back on cache and test you site's speed again.

Good luck! Hope I helped, I am new to this as well. If anyone has any ideas or better solutions I'd love to know too.
 
Also, be aware Google's Pagespeed score is only based on the bottom 25% of 4G connections.



https://www.webpagetest.org/ is more accurate with their speeds and you can test your site on more connections (Fast 4g, Slow 4g, 3g, Android, Iphone, Desktop). You can test from More locations. You can also test your site's speed after cache is applied (second view) and it will take video to view as well.
 
For improve website speed score, browser caching is important is because it reduces the load on your web server, which ultimately reduces the load time for your users.

Try some codes in htaccess

Apache config:
Header set X-XSS-Protection "1; mode=block"


 # START 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

# START DEFLATE COMPRESSION
<IfModule mod_deflate.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" \
"application/x-font-opentype" \
"application/x-font-otf" \
"application/x-font-truetype" \
"application/x-font-ttf" \
"application/x-javascript" \
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"font/eot" \
"font/otf" \
"font/ttf" \
"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

# 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 #

# ENABLE MOD PAGESPEED START
# COMBINE CSS, COMPRESS IMAGES, REMOVE HTML WHITE SPACE AND COMMENTS
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters rewrite_css,combine_css
ModPagespeedEnableFilters recompress_images
ModPagespeedEnableFilters convert_png_to_jpeg,convert_jpeg_to_webp
ModPagespeedEnableFilters collapse_whitespace,remove_comments
</IfModule>
# ENABLE MOD PAGESPEED END

# 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

# START – Disable server signature #
ServerSignature Off
# END – Disable server signature #
 
if you have done your optimization add your site to cloudflare and configure it.

After that enable a worker for your site on cloudflare, it's free
here is a easy tutorial: https://www.tutorialcup.com/wordpress/cloudflare-worker-wordpress.htm

What i also use is the plugin WP Cloudflare Super Page Cache: https://wordpress.org/plugins/wp-cloudflare-page-cache/
It basicly makes your wordpress (nearly) static so cloudflare can cache it




My only problem is the mobile pagespeed with 70% (dekstop is 99%), google says i can optimize my js and css by 0.4s, which is realy hard (already did Asset Cleanup, maybe some small pieces i can unload, but most is optimized i think)
 
For improve website speed score, browser caching is important is because it reduces the load on your web server, which ultimately reduces the load time for your users.

Try some codes in htaccess

Apache config:
Header set X-XSS-Protection "1; mode=block"


# START 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

# START DEFLATE COMPRESSION
<IfModule mod_deflate.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" \
"application/x-font-opentype" \
"application/x-font-otf" \
"application/x-font-truetype" \
"application/x-font-ttf" \
"application/x-javascript" \
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"font/eot" \
"font/otf" \
"font/ttf" \
"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

# 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 #

# ENABLE MOD PAGESPEED START
# COMBINE CSS, COMPRESS IMAGES, REMOVE HTML WHITE SPACE AND COMMENTS
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters rewrite_css,combine_css
ModPagespeedEnableFilters recompress_images
ModPagespeedEnableFilters convert_png_to_jpeg,convert_jpeg_to_webp
ModPagespeedEnableFilters collapse_whitespace,remove_comments
</IfModule>
# ENABLE MOD PAGESPEED END

# 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

# START – Disable server signature #
ServerSignature Off
# END – Disable server signature #
@vehla Sorry for the question, but I'm a beginner. Can I put all these codes on any website, or can it be a problem, such as with a plugin or hosting? I thank you for your attention.
 
@vehla Sorry for the question, but I'm a beginner. Can I put all these codes on any website, or can it be a problem, such as with a plugin or hosting? I thank you for your attention.

if you're using a caching plugin, that's not necessary to put it manually. make sure if you make a change on the cache plugin to purge all the cache (if using lscache) or clear all cache. And follow all the above tutorials. maybe you have many 3rd party code that running on your wp site.
 
These are such helpful tips (for someone facing the same problem). Thank you so much guys!
 
Hey, I built a website on wordpress but page load speed is pretty bad on GT Metrix & Google Page Insights.


Can someone help me out? I tried W3 Cache, WP-Rocket, etc caching plugins still no effect.


Any help would be appreciated :) Thanks
make sure hosting is not shared hosting, vps ram 8gb using nginx with cache function memcached/apc or redis is good enough in my opinion, don't use too many unnecessary plugins and pages that are too over use a website builder like elementor/oxygen etc
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock