• Premium user.

    Issue: When copying DB from my local dev site using a different domain the cache files have to be deleted on the production instance manually otherwise the local domain is referenced on the prod site.

    Request (any or all):

    • Do not store or reference a domain in any cache mechanisms – this should be domain agnostic and respect relative paths set intentionally by the admins (I checked cache folder/files to verify)
    • Allow option to exclude/disable based on domain, not just URI
    • Provide code I can put in functions.php or wp-config.php to dynamically and automatically disable the plugin based on site URL or similar simple domain check (i.e. my local dev domain), otherwise enabled, i.e. in prod.

    Thank you.

Viewing 1 replies (of 1 total)
  • Thread Starter jgoldbloom

    (@jgoldbloom)

    Followup:

    For now in the bottom of wp-config.php (also works in child theme functions.php) I added a simple domain check to set a constant which if defined dynamically handles plugin deactivation/activation following WP API standards:

    if (defined('DEVELOPEMENT_SITE')) {
    		
    	deactivate_plugins(array(ABSPATH.'wp-content/plugins/wp-fastest-cache/wpFastestCache.php',ABSPATH.'wp-content/plugins/wp-fastest-cache-premium/wpFastestCachePremium.php'));
    	  
    }
    else {
    	
    	activate_plugins(array(ABSPATH.'wp-content/plugins/wp-fastest-cache/wpFastestCache.php',ABSPATH.'wp-content/plugins/wp-fastest-cache-premium/wpFastestCachePremium.php'));
    
    	
    }
    

    I won’t include the line that sets the constant as that’s proprietary but for anyone else the above gets it done as an interim solution. Note the array includes both free/premium versions so edit for your needs. Also, the WP function to activate won’t reactivate a plugin already activated.

    I really wish this technique was not necessary – I firmly advocate agnostic domains and feel plugin authors should account for that and make it so developers need not be required from their customer base for basic/critical situations like dev/prod environments. My .02.

Viewing 1 replies (of 1 total)
  • The topic ‘Disable on local dev environment with different domain?’ is closed to new replies.