Answer the question
In order to leave comments, you need to log in
Wordpress: how to remove /?ver=... from file path?
Friends, there is a problem. The site came for editing, and so at the end of each css / js file there is a certain url prefix of this kind: www.mysite.ru/wp-content/themes/awesom_theme/css/main.css/?ver=1 . In this case, there was an example with a css file. Given this, any files that really lie on the server, for example, the same main.css style, cannot be edited, and the same old file with ?ver=1 at the end is rolled out to the working version anyway. How to solve this problem? In fact, you need to change several styles on the site and add a little new ones, but I don’t know how to get close to this :(
Answer the question
In order to leave comments, you need to log in
github gist
Remove version from scripts and styles links:
function wp_version_js_css($src) {
if (strpos($src, 'ver='))
$src = remove_query_arg('ver', $src);
return $src;
}
add_filter('style_loader_src', 'wp_version_js_css', 9999);
add_filter('script_loader_src', 'wp_version_js_css', 9999);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question