diff --git a/templates/features.php b/templates/features.php index 901ce8aae..753ff17b0 100644 --- a/templates/features.php +++ b/templates/features.php @@ -8446,7 +8446,8 @@ function ampforwp_wp_rocket_compatibility($content){ $cdn_url = get_option('wp_rocket_settings'); if($cdn_url['cdn'] == 1){ $cdn_url = $cdn_url["cdn_cnames"][0]; - $content = preg_replace('/src="(.*?)wp-content(.*?)"(.*?)>/', 'src="'.$cdn_url.'/wp-content$2"$3>', $content); + $content = preg_replace('/src="(.*?)\/\/(.*?)wp-content(.*?)"(.*?)>/', 'src="$1//'.$cdn_url.'/wp-content$3"$4>', $content); + $content = preg_replace('/srcset="(.*?)\/\/(.*?)wp-content(.*?),(.*?)\/\/(.*?)wp-content(.*?),(.*?)\/\/(.*?)wp-content(.*?)"/', 'srcset="$1//'.$cdn_url.'/wp-content$3,$4//'.$cdn_url.'/wp-content$6,$7//'.$cdn_url.'/wp-content$9"', $content); } } return $content;