rtCamp / nginx-helper

Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
https://wordpress.org/plugins/nginx-helper/
228 stars 121 forks source link

New filter for RT_WP_NGINX_HELPER_CACHE_PATH default constant value #298

Open SGr33n opened 1 year ago

SGr33n commented 1 year ago

HI! Today I’m developing a plug-in that should change the value of RT_WP_nginx_helper_cache_path. However, I am noticing that even if I give maximum priority to the definition of this constant, the one set on the Nginx_helper class is always the one that set the value.

This would be due to the fact that the plug-in I am developing has the name that starts for S, while nginx-helper starts with N, so it is loaded before and I cannot configure the wanted value unless I set it up in the wp-config.php.

At this point I would like to ask if it was possible to add a filter:

class-nginx-helper.php line 87

        if ( ! defined( 'RT_WP_NGINX_HELPER_CACHE_PATH' ) ) {
            define( 'RT_WP_NGINX_HELPER_CACHE_PATH', apply_filters( 'rt_nginx_helper_cache_path', '/var/run/nginx-cache' ) );
        }

In this way it would be much easier to set a custom value of RT_WP_NGINX_HELPER_CACHE_PATH.

Thank you!