• As for the title:

    It’d be super-useful to have the possibility to set the “Cache Zone Path” via wp-config.php in stateless environments (eg. K8s).

Viewing 3 replies - 1 through 3 (of 3 total)
  • +1 (this would make it more compatible with WP Multisite also)

    Thread Starter Giovanbattista Amato

    (@gioamato)

    I will try to free some time in the next months to look at this and contribute.

    Could you please elaborate more on the WP Multisite issues?

    Whipped up a quick plugin to place in mu-plugins, functions.php or a regular plugin:

    
    function fix_nginx_cache_path($cache_path) {
    	$cache_path = defined( 'NGINX_CACHE_PATH' ) ? NGINX_CACHE_PATH : $cache_path;
    	return sanitize_text_field( $cache_path ); 
    }
    add_filter( 'default_option_nginx_cache_path', 'fix_nginx_cache_path' );
    add_filter( 'option_nginx_cache_path', 'fix_nginx_cache_path' );
    add_filter( 'pre_update_option_nginx_cache_path', 'fix_nginx_cache_path' );
    
    function fix_nginx_auto_purge($auto_purge) { 
    	$auto_purge = defined( 'NGINX_AUTO_PURGE' ) ? NGINX_AUTO_PURGE : $auto_purge;
    	return absint( $auto_purge ); 
    }
    add_filter( 'default_option_nginx_auto_purge', 'fix_nginx_auto_purge' );
    add_filter( 'option_nginx_auto_purge', 'fix_nginx_auto_purge' );
    add_filter( 'pre_update_option_nginx_cache_path', 'fix_nginx_auto_purge' );
    

    Then set NGINX_CACHE_PATH (full path string) and NGINX_AUTO_PURGE (1 or 0) in wp-config.php to your needs.

    Hope that helps ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Feature Request] Ability to set Cache Zone Path from wp-config.php’ is closed to new replies.