A great WordPress Caching Tip to Improve Page Speed for SEO

If you run a WordPress blog (or several) and have a caching plugin, then great! Your pages should load faster now whenever someone comes to visit – or even Google itself. Page speed has become a very important topic for SEO managers these days, and this tip will certainly help.

But wait…most WordPress cache plugins reset the cache every time that a new post is added – or an existing post is edited/deleted. This means that you will have to wait until someone – or a Google bot – has visited all pages before they load from cache again. Booo!

However, there is a little trick I use to ensure that any non-cached pages are frequently cached, just in case someone – or Google when indexing the site – gets a slooooow page.

It’s a very simple command that you place into a crontab file, which is on all Linux operating systems, including Apple Macs.


Go into a terminal app and type

crontab -e

and paste in the following line of code at the bottom (changing ‘yoursite.com’ for your own website).

0 * * * * wget -r --no-parent  --reject jpg,png --accept html https://www.yoursite.com

Then save the crontab file.

You can test the command itself by typing it straight into the terminal:

wget -r --no-parent  --reject jpg,png --accept html https://www.yoursite.com

You will then see various URLs from your website appear in the terminal window, which means that these pages are being read – and cached.


This will enable the ‘wget’ command to run at the first minute of every hour. The wget command visits all pages of a website, meaning that if a page isn’t yet cached, then it will be each time it is visited by ‘wget’. This means that in the worst case scenario, your pages are only ever a maximum of one hour away from being cached and therefore running very fast indeed.

Although you don’t need to know them in detail, the options within the wget command tell it to visit all the way thru the site without downloading any files, and ignore jpg and png files, but visit all html pages.

The computer (or server) that you run this command on should ideally be on 24 hours a day for this to ensure the greatest level of cached-pages delivered.

Not being a Windows user (I’m a Linux and Chromebook user these days), I don’t know what the equivalent command is, but with a quick search, I found Wget for Windows which will allow the same kind of functionality. I assume that you will have to place this in the Windows equivalent of crontab.

I hope that you find this useful. It works wonders for several WordPress (and non-WordPress) websites that I manage.

Latest

Latest News & Blogs