Title: bikkun's Replies | WordPress.org

---

# bikkun

  [  ](https://wordpress.org/support/users/bikkun/)

 *   [Profile](https://wordpress.org/support/users/bikkun/)
 *   [Topics Started](https://wordpress.org/support/users/bikkun/topics/)
 *   [Replies Created](https://wordpress.org/support/users/bikkun/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/bikkun/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/bikkun/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/bikkun/engagements/)
 *   [Favorites](https://wordpress.org/support/users/bikkun/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Smart Variations Images & Swatches for WooCommerce] Not working with CDN](https://wordpress.org/support/topic/not-working-with-cdn-2/)
 *  Thread Starter [bikkun](https://wordpress.org/support/users/bikkun/)
 * (@bikkun)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/not-working-with-cdn-2/#post-9482733)
 * That works, thanks!
    Here is the fixed I used, had to hard code the types and
   cdn url because w3total stores its config in a text file.
 *     ```
       function cdn_image_url($url)
        {
            $types = ["gif", "png", "jpg"];
            $type = substr($url, -3); 
   
            if(in_array($type, $types)) {
                $site = get_site_url();
                $cdn = "{Insert cdn url here}";
                $url = str_replace($site, $cdn, $url);
            }    
            return $url;
        }
        add_filter ('wp_get_attachment_url', 'cdn_image_url');
       ```
   

Viewing 1 replies (of 1 total)