Support » Plugins and Hacks » W3 Total Cache » More flexible constants

  • In define.php fiile you have defnitions of two constants which determines location of configuration and cache files

    define('W3TC_CACHE_DIR', WP_CONTENT_DIR . '/cache');
    define('W3TC_CONFIG_DIR', WP_CONTENT_DIR . '/w3tc-config');

    It would be much more flexible to define them as:

    if (!defined('W3TC_CACHE_DIR'))
        define('W3TC_CACHE_DIR', WP_CONTENT_DIR . '/cache');
    
    if (!defined('W3TC_CONFIG_DIR'))
        define('W3TC_CONFIG_DIR', WP_CONTENT_DIR . '/w3tc-config');

    Flexibility and pragmatism is the reason why many experienced developers use WordPress. In my case I created the setup where many sites may run from the same directory (use the same theme, the same set of plugins, but different database and upload dirs). It is a bit simmilar to multisite but for some reasosns better for me. It is easy to setup and maintain thanks to clever wp-config.php file. Unfortunately I cannot use W3TotalCache in this setup beacuse I cannot define config dirs for each site separately (especially there are some problems with CDN paths). This small fix would help in this case. I know my configuration may seem a bit strange, but why not. I use no dirty hacks, no bad practices, just WordPress flexibility.

    https://wordpress.org/plugins/w3-total-cache/

  • The topic ‘More flexible constants’ is closed to new replies.