Using a different CDN for script enqueuing

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;