Sunday, January 30, 2022

[FIXED] Wordpress: Serve images from a CDN

Issue

I use a CDN to serve my images, which I upload into Wordpress. My settings were:

enter image description here

It worked perfectly but it doesn't work anymore since I updated to Wordpress 4.5. This are my settings now:

enter image description here

This filter doesn't work either:

function my_cdn_upload_url() {
   return 'http://media.mydomain.com';
}
add_filter( 'pre_option_upload_url_path', 'my_cdn_upload_url' );

Does anyone know how should I serve my images from a CDN?

Thank you.


Solution

The easiest way is editing the content of "upload_url_path" in the wp_options table:

upload_url_path > http://media.mydomain.com

Thank you!



Answered By - retroriff

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.