Skip to content

Instantly share code, notes, and snippets.

@jamesmorrison
Created October 5, 2017 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmorrison/79924f67e979cea3a89ce4507246611b to your computer and use it in GitHub Desktop.
Save jamesmorrison/79924f67e979cea3a89ce4507246611b to your computer and use it in GitHub Desktop.
When enqueueing a script or style, use `filemtime` to set the file version to the Unix timestamp for when the file was last modified
<?php
/* Obviously, add this to a function that hooks into wp_enqueue_scripts() (or admin_enqueue_scripts()) */
wp_enqueue_style( 'main', get_stylesheet_directory_uri() . '/style.css', false, filemtime( get_stylesheet_directory() . '/style.css' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment