WordPress Remove CDN Version from URL

wordpress remove cdn

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 );

Stay in the loop with our web development newsletter - no spam, just juicy updates! Join us now. Join our web development newsletter to stay updated on the latest industry news, trends, and tips. No spam, just juicy updates delivered straight to your inbox. Don't miss out - sign up now!

We’ve tried our best to explain everything thoroughly, even though there’s so much information out there. If you found our writing helpful, we’d really appreciate it if you could buy us a coffee as a token of support.

Also, if you’re interested in learning more about WordPress, Javascript, HTML, CSS, and programming in general, you can subscribe to our MailChimp for some extra insights.


This site uses Akismet to reduce spam. Learn how your comment data is processed.