Hey guys I am developing a wp theme, and I am using for localhost server XAMPP and Wampserver.So anytime I save my changes specially for css and js it doesn't take effects immediately! sometimes it can takes up to 24h for the changes to take effects, how can I solve this issue, it really slowdown my work???
Hey guys I am developing a wp theme, and I am using for localhost server XAMPP and Wampserver.So anytime I save my changes specially for css and js it doesn't take effects immediately! sometimes it can takes up to 24h for the changes to take effects, how can I solve this issue, it really slowdown my work???
Share Improve this question asked Aug 4, 2020 at 7:55 Chris Shabani MuswambaChris Shabani Muswamba 12 bronze badges 2- Where do you view your work? In the web? When you save the code and open your project in web you can clear the cache. This should work and the changes should come up immediately. Try this and when it works you can download "Clear Cache" for Google Chrome and do this with just one click. – mivanov Commented Aug 4, 2020 at 8:09
- 1 The above comment was posted as an answer not a comment, and the reply was lost during the conversion process, the OP replied with "Hi, thanks for comment. Yes I use chrome and I do clear cache" – Tom J Nowell ♦ Commented Aug 4, 2020 at 8:58
2 Answers
Reset to default 0Try changing the version number on .css and .js files when you change them. That can be a real pain while you are developing so you can use a random number.
$randomizr = $rand = rand( 1, 99999999999 );// Enqueue scripts and styles
wp_enqueue_script( 'my-script', get_stylesheet_directory_uri() . '/assets/js/my-script.js', array('jquery'), $randomizr, true );
thanks for the answers. I fixed this issue with wp_super_cache plugin and I also converted my css file to sass. And I clear my browser and time I save my changes (css and js )