A General Technology & Development Blog

Technology, Development, Programming – Magento, Wordpress.

Home » Add time stamp to stylesheet to stop server caching

Add time stamp to stylesheet to stop server caching

Do you have a problem with server caching on your web server?

This can be very annoying when developing a new website.

I first noticed this when developing a new client website on one.com servers who are famous for caching.

What this means:

Server caching by web hosts is great for running live websites as it cuts down loading time and increases browsing site-speed. However, when it comes to making changes to the site (development), these change take between 2 to 60 minutes.

To stop your website from being affected by the server cache, you can add a time stamp to your stylesheet. Here is the code for the default theme stylesheet when developing WordPress websites:

<link rel=stylesheet href=”< ?php
echo get_stylesheet_uri()
. ‘?t=’ . filemtime( get_stylesheet_directory() . ‘/style.css’ );
? >”>

Here are a couple of links with discussion and examples of usage; here, here and here.

  • Was this Helpful ?
  • Yes   No

Name of author

Name: BlogOwner

Short Bio: "The master has failed more times than the beginner has even tried."

eXTReMe Tracker