Should I cache my entire site?




I have a 6 pages website which I don’t update or update the home page (only) once in 1-3 months with small snip text and an image, just to add fresh content to Google. The website is monetized with Adsense and is hosted on a VPS. It is a free service website which has a form in which people provide a link to get something and with JS I send request to a function in my theme functions.php where I communicate to another server with an API.

I would very much like to minimize the resources that it cost to the VPS by caching everything on my site.

I have few questions regarding this and I hope you may give me some answers or at least tips.

  1. If I cache everything will the JS and the PHP function work?
  2. Is it in some way violation of the AdSense policy as the Adsense code is JS and I will cache it too?
  3. Will it affect in any way the SERP position of the website?
  4. Is adding only a page rule enough for this cache? Like “” and put there cache everything.

At this moment I am using w3 total cache and hummingbird which remotely control my Cloudflare with an API. For example, Hummingbird minifies everything but the Adsense js code (this is my 2. concern). I know caching isn’t minification and it is in no way adjusting the Adsense code at all - I just cache it.
I am very satisfied with the speed of my website (89 mobile and 94 desktop) but I would like to decrease the server load as the traffic to the website is increasing constantly every single day and I want to server the best possible experience for my users too.


If you only have 6 pages, set the static pages up as Page Rules to ‘Cache Everything’. Don’t cache the interactive pages.
As far as I know, adsense runs in the browser. So it’s safe to cache that JS as well.

As you increase the speed of the site, SE rank should improve as well.


Thanks for your answer @jules

What about the javascript that powers the php function? Will it run without issue too?


Typically JS files are themselves static and are cached by default. It’s the PHP function that is dynamic.
But, does your app dynamically write js code inline? If so, you cannot cache those pages.

Can you post the site for inspection?


I have just made 1 page rule where I have added Edge Cache TTL to 1 month and Cache Level to Cache Everything.

Here is the website:



Looks like it’s working. You can probably add rules for all those footer links too, except for Contact.


Thanks for your review @jules

What do you mean? My page rule is for* which will cache all the pages if I am not in a mistake?

Why I shouldn’t cache the contact form page?


I have added a page rule for the contact page but It doesn’t work. I have added it as 1st rule.

EDIT: Appears to be the latest version of contact form 7 issue


If you cache all pages, they cannot be dynamic. Users will be served the cached copy instead of the new data. Basically any page dealing with forms or url variables should not be cached (but there are exceptions to everything!)


As you are using WordPress, try setting the Page Rules as follows -

  1. mydomain.tld/wp-admin*
    Cache Level - Bypass

  2. mydomain.tld/wp-json*
    Cache Level - Bypass

  3. mydomain.tld/*
    Cache Level - Cache Everything

The second rule should let the Contact Form work because the contact form is sending request to a endpoint of the type - www.mydomain.tld/wp-json/contact-form-7/v1/contact-forms/94/feedback . Also, we are bypassing the cache for the WP Admin area, otherwise that too will become cached and accessible to publc. The order of these page rules matter

Also, you can use a plugin called Sunny - - which will automatically invalidate cache on CloudFlare when changes are made in pages


Would be great to have ignore query strings and cache everything available.


Thanks for your replays guys.

I was with enabled page rules for 1 day exactly and during that day my adsense earnings were 60-80% less than the rest of the days during that week and 75% less than that day but the previous week. So I have disabled it for now, until I study this problem. Because my users are refreshing the page each 5-10 mins (some of them) I think that the ads are not refreshing with the page refresh but each 15 mins from google servers, nor they serve targeted ads (aka ads to US users are showing like ads for GER useres for example).


Shouldn’t you also bypass cache for wp-login?


Hello, yes you can bypass the cache of the wp-admin. However, even if u don’t when people type it they will find themselves in the dashboard area where they can’t navigate anything. Whatever they navigate to, they will be redirected again to the login page. So this is not mandatory. Anyway, I wasn’t using bypass but regular cache on that page. The contact form worked without bypassing the cache, also.


While this is technically true, I really highly recommend you bypass cache for wp-admin.

wp-admin URLs are known quantities (e.g. /wp-admin/plugins.php or wp-admin/options-general.php) so, while someone curious wouldn’t be able to change anything per se, they would still be able to glean a lot of information just by digging around your site - such as admin email address, list of all users and their email addresses, status of plugins (potentially finding outdated plugins and then exploiting flaws in them), etc.

This may not be the best analogy, but I would not want someone looking around at the settings of my computer, even if they weren’t allowed to change them…

split this topic #16

A post was split to a new topic: Converting Menu Buttons and Not Working