0

I used to think this was an issue with Google Chrome, when I would struggle to get pages to refresh with their latest CSS styles — despite me having the option set to disable cache when inspector tools are open.

More recently however, I've noticed I get this problem with php files too, e.g. WordPress templates files. I will often make changes to them, upload via FTP and have to refresh my browser multiple times in order to see the changes.

Tonight things seem unusually bad. I've even tried renaming the folder for the theme that I am building, which should break everything... but my whole website is loading as normal as though nothing has changed. It is so bad at refreshing that I can't even break it!

I have a template file called contact.php which I can't get to refresh to the latest version... I've also tried renaming the file in order to break it, but WP is still loading the page with that template.

I've even tried get_page_template() which confirms that it is the contact.php that is applied to the page despite me having renamed it on the server

Could this be an issue with my hosting company? or should I look at caching plugins?

3
  • 1
    Did you try disabling and clearing cache plugins?
    – Steve
    Nov 1, 2020 at 23:43
  • I don't have any cache plugins installed, might it be worth trying one?
    – user47053
    Nov 1, 2020 at 23:46
  • Don't add a cache plugin while this problem exists.
    – davidgo
    Nov 2, 2020 at 0:38

1 Answer 1

1

(Assuming you are not running a cache in Wordpress) The problem here could exist in 3 or 4 places -

  1. In your browser.
  2. In the setup for your webserver or website.
  3. With an ISP between you. (This is highly unlikely, and if you are using HTTPS and are not in a corporate environment where they control your device this is not the case).
  4. If you are using a caching/cdn service this could be a source of caching as well.

What is likely happening is that (1) and (2) are working in concert - specifically when a page is requested the webserver is adding "Cache-Control" headers, which your browser then remembers. This can be done in Wordpress, or in a .htaccess file or in the web server configuration, or, if you are using something like Cloudflare at their side. To ascertain this is happening you can try flushing your browser cache or using an alternative browser. Alternatively only in some cases you can simply throw ?random-content at the end of the url, or open a private browsing Window

If that works, then you know the problem is outside your Wordpress setup and you should look at any .htaccess or web server configuration file you have, or raise it with your ISP.

8
  • Using ?random-content parameters will help get a fresh initial page load, but probably won't have any effect on cached CSS, JS, and images that the page is using. Nov 2, 2020 at 1:46
  • @StephenOstermiller - Yup. I'll update the post for completeness. Absolutely right on the ?random-content bit (hence the only in some cases I added)
    – davidgo
    Nov 2, 2020 at 2:34
  • Thanks, I've tried reloading the page in Incognito mode and also tried adding a ? variable in the URL but still no luck
    – user47053
    Nov 2, 2020 at 11:15
  • ...I've even tried clearing my browser cache + all history but that still doesn't work! might it be worth me contacting my hosting company? probably a last resort as they take forever to reply
    – user47053
    Nov 2, 2020 at 11:17
  • 1
    Are you sure you are editing the correct location. (For example, I have multiple servers. Occasionally I do something stupid like edit an old copy rather then a current one. Everything changes but nothing works).
    – davidgo
    Nov 2, 2020 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.