-
Notifications
You must be signed in to change notification settings - Fork 0
Alter CDN
tacoen edited this page Mar 13, 2014
·
5 revisions
Not all we has a good Internet Connections to google CDN. If you are WordPressing behind a firewall, this might you handy friends.
Don't use this options if Google CDN was easy for you.
We don't make this an options, because I'm sure you need more than it
function cdn_takeover() {
if (!is_admin()) {
add_filter('script_loader_src','cdn_replace');
add_filter('style_loader_src','cdn_replace');
}
}
function cdn_replace($a) {
$mycdn = "mycdn.url"
if (preg_match("#ajax\.googleapis\.com#",$a)) { return str_replace("ajax.googleapis.com",$mycdn,$a);}
else { return $a; }
}