wp-content » themes » functions.php » Remove file version strings from CSS and JS links

Remove file version strings from CSS and JS links

By default .css and .js files used in WordPress themes and plugins will add a version number using ?ver=

image 6 - Remove file version strings from CSS and JS links

To disable this add the following inside your theme functions.php file or as a new plugin:

//Remove version strings from CSS and JS links

add_filter( 'style_loader_src', 'wpxss_remove_version' );
add_filter( 'script_loader_src', 'wpxss_remove_version' );

function wpxss_remove_version( $url )
{
    return remove_query_arg( 'ver', $url );
}

See also  Disable WordPress plugins via FTP or within PHPMyAdmin

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended