Filter to replace URLs with CDN url?
-
Hey guys,
I have an AJAX function which is returning content but W3 is not applying my CDN CNAME to URLs. I assume I need to pass this through another filter?
Does anyone know a filter that can take supplied content (HTML) and replace the site’s url with the CDN’s CNAME. I wrote my own, but would like to use native filters if they exist.
Example:
$content = https://mysite.com/wp-content/uploads/2021/image.jpg
$content = apply_filters(‘w3tc_cdn_urls’, $content);Output of $content would then be filtered to:
$content = https://mycdn.cname.com/wp-content/uploads/2021/image.jpgI tried using w3tc_processed_content, but I don’t think I instantiated that correctly, could I simply use New W3TC\Generic_Plugin, then call ob_callback( $buffer )?
Cheers,
C.
- The topic ‘Filter to replace URLs with CDN url?’ is closed to new replies.