Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress not updating the js file

I am changing a JavaScript file, but it is not showing up in the browser. I cleared browser cache, I purged the cache through wp-admin, I removed the deflate code from .htaccess, but still it doesn't show up.

themes/soundwave/js/prettyPhoto.js?ver=4.2.3

when I add any other number in the ver for example, in the url if I type:

themes/soundwave/js/prettyPhoto.js?ver=4.2.3.1

the change is shown.

like image 750
Sandhya Nambiar Avatar asked Aug 05 '15 13:08

Sandhya Nambiar


1 Answers

During development, you could avoid the hassle of clearing the browser cache by passing a dynamic variable as the file's version when you enqueue it. For instance, the current time.

wp_enqueue_script( 'prettyPhoto', 'prettyPhoto.js', array(), date("h:i:s") );

like image 192
Hareesh Sivasubramanian Avatar answered Oct 27 '22 01:10

Hareesh Sivasubramanian