Ready to get started?Download WordPress


W3 Total Cache
More flexible constants (1 post)

  1. Marek Sobol
    Posted 3 months ago #

    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.



You must log in to post.

About this Plugin

About this Topic