• I tryed a lot of plugins before trying this one. Get big problems with S3 uploads with some plugins and code. This one works plug and play. I’m trying the full cloud offloading now. I’ll probably need to track now some remaining links that use my local files from code (metabox elements) or oxygen templates now, before doing the full switch. But look like it’s feasible, gotta try.

Viewing 1 replies (of 1 total)
  • Thread Starter pixluser

    (@pixluser)

    // ✅ 1. Filtre pour wp_get_attachment_url()
    add_filter('wp_get_attachment_url', function($url) {
    $local = 'https://domain.com/wp-content/uploads';
    $cdn = 'https://media.domain.com/wp-content/uploads';

    // ✅ Remplace uniquement si c'est encore une URL locale
    if (strpos($url, $local) === 0) {
    $url = str_replace($local, $cdn, $url);
    }

    return $url;
    });

    // ✅ 2. Filtre pour wp_get_attachment_image_src()
    add_filter('wp_get_attachment_image_src', function($image) {
    $local = 'https://domain.com/wp-content/uploads';
    $cdn = 'https://media.domain.com/wp-content/uploads';

    // ✅ Assure qu'on modifie bien une URL valide
    if (is_array($image) && isset($image[0]) && strpos($image[0], $local) === 0) {
    $image[0] = str_replace($local, $cdn, $image[0]);
    }

    return $image;
    });

    This code helped to replace my dynamic content in metabox .io views. And some others places.
    For the static oxygen builder content, I’will have to do it by hand maybe.

    I don’t know if it can be an option directly inside the plugin (can be usefull maybe). And can be made better for sure.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this review.