<?php wp_enqueue_style( 'theme-styles', get_stylesheet_directory_uri() . '/style.css', array(), filemtime( get_stylesheet_directory() . '/style.css' ) ); wp_enqueue_script( 'custom-js', get_template_directory_uri() . '/js/custom.js','', time() ); ?>
What it does
The code above will append a ‘?ver=‘ parameter with the timestamp of when a file was modified. When browsers see a change in a file’s URL parameter, they will treat it as a new file and redownload it to the cache. This will essentially make the browser reload the cache every time you’ve made changes to the files.