• Resolved aberkow

    (@aberkow)


    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

    (@vmarko)

    Hello @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

    (@aberkow)

    Hi @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.