Add version to WordPress theme CSS file.


/ Published in: PHP
Save to your folder(s)

Very useful line of code that I'm using very often to prevent old and cached CSS file being served to visitors. You just need to use timestamp of the file.


Copy this code and paste it in your HTML
  1. <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_url'). '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" />

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.