WordPress RSS feed image url replace string from raw url to CDN url
I have a WordPress website that uses Cloudflare and Mailchimp.
On Cloudflare I have scrape shield and hotlink protection activated.
The Mailchimp campaign uses the WordPress site RSS to automate a newsletter.
However, the images from the newsletter are being firewall blocked by the hotlink protection (since it was activated. )
I would like to rewrite the RSS image urls (just RSS image ursl – not all image urls) to Jetpack photon CDN urls ie from https://yourwebsite.com/uploads/image.jpg to https://i0.wp.com/yourwebsite.com/uploads/image.jpg
The images will then bypass the Cloudflare hotlink protection.
Please can someone let me know how I can do this with code inserted into the child theme functions.php ? Thanks.
Leave an answer