Versioning CSS & JavaScript

You know the scenario. You’re developing (or updating) a site and want to present it to your clients. But their browser cache does not let them see any of the changes you made. It can get worst. The cache updates only some the files and suddenly your clients’ precious site looks completely broken.

Pentru WordPress treaba e simpla, trebuie adaugat filemtime in parametrul $ver din wp_enqueue (script sau style).

Exemplu:

wp_enqueue_script('core-js', get_template_directory_uri() . '/js/core.js', array(), filemtime(get_template_directory() . '/js/core.js'), true);