Title: Multisite &#8211; detect CDN settings programmatically
Last modified: September 20, 2022

---

# Multisite – detect CDN settings programmatically

 *  Resolved [aberkow](https://wordpress.org/support/users/aberkow/)
 * (@aberkow)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/multisite-detect-cdn-settings-programmatically/)
 * Hello,
 * I’m working on a multisite where W3TC is set to use individual site configs. 
   Some of the sites use a CDN and others don’t. Is there a way to programmatically
   detect the W3TC settings on the frontend of each site? I’d like to do this to
   help me serve CSS background images over the CDN where appropriate. I looked 
   in the database, some of the W3TC filters, classes, etc but didn’t find anything
   that worked as I expected.
 * Thanks for any help you can provide.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/multisite-detect-cdn-settings-programmatically/#post-16028010)
 * Hello [@aberkow](https://wordpress.org/support/users/aberkow/)
 * Thank you for reaching out.
    I am not sure what exactly you are referring to,
   once the individual config is used, individual sites are saved with the blog 
   id as the file. If I understand your question, there is no hook for the filter
   in the w3tc to achieve that – programmatically detect the W3TC settings on the
   frontend of each site
 * Thanks!
 *  Thread Starter [aberkow](https://wordpress.org/support/users/aberkow/)
 * (@aberkow)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/multisite-detect-cdn-settings-programmatically/#post-16031369)
 * Hi [@vmarko](https://wordpress.org/support/users/vmarko/)
 * Thanks for getting back to me so quickly. I only needed a few settings plus some
   additional flexibility. I was able to resolve this by writing a class similar
   to this.
 *     ```
       <?php
   
       use W3TC\Config;
   
       class My_Class {
         private $config;
         public function __construct() {
           $this->config = new Config();
         }
   
         public function is_cdn_enabled() {
           return $this->config->get_boolean('cdn.enabled');
         }
   
         // other methods...
       }
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Multisite – detect CDN settings programmatically’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [cdn](https://wordpress.org/support/topic-tag/cdn/)
 * [multisite](https://wordpress.org/support/topic-tag/multisite/)
 * [settings](https://wordpress.org/support/topic-tag/settings/)

 * 2 replies
 * 2 participants
 * Last reply from: [aberkow](https://wordpress.org/support/users/aberkow/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/multisite-detect-cdn-settings-programmatically/#post-16031369)
 * Status: resolved