Using a different CDN for script enqueuing

Need help with this?
Purchase All in One SEO Pack Pro to get dedicated support from us.

Buy Now

Some features in All in One SEO Pack require us to enqueue external dependencies through CDNs. You can dynamically filter the CDNs we rely on through the script_loader_src filter. Below you can find a demo code snippet that shows you how to use this filter. This can be useful if you’re operating from a country where certain CDNs are blocked.


add_filter( 'script_loader_src', 'aioseop_change_cdn_provider' );

function aioseop_change_cdn_provider( string $src ) {

   if( ! is_admin() ) {

   if( preg_match('/.**/', $src ) ) {
      $src = '';

return $src;

  • Was this helpful ?
  • YesNo