WordPress Remove CDN Version from URL

In most cases having a file version on CDN URL will likely generate an issue to load, below is the code to help you remove the file version of CDN URL:

function theme_name_cdn_version_remove( $src ) {

    if( strpos( $src, 'cdn_name_here.com' ) )
      $src = remove_query_var( 'ver', $src );

    return $src;

add_filter( 'script_loader_src', 'theme_name_cdn_version_remove', 9999 );

Leave a Reply

Your email address will not be published. Required fields are marked *