?ver=2.0.2 preventing edits to a wordpress file from reflecting in the frontend.. how do solve this?

  • Thread starter Thread starter Deleted member 1333509
  • Start date Start date
Your .css?ver=2.0.2 asset is likely cached which is why you are not seeing your changes. Are you using Cloudflare and/or a plugin like W3 Total Cache or a CDN? You will need to clear these caches to see the changes. You can disable browsing caching in your dev tools as well to prevent your browser from caching files.

Here's code to remove query strings or you can use a WP plugin if you really want to remove the version from static assets.

PHP:
function remove_query_strings() {
   if(!is_admin()) {
       add_filter('script_loader_src', 'remove_query_strings_split', 15);
       add_filter('style_loader_src', 'remove_query_strings_split', 15);
   }
}

function remove_query_strings_split($src){
   $output = preg_split("/(&ver|\?ver)/", $src);
   return $output[0];
}
add_action('init', 'remove_query_strings');
 
Back
Top