• Resolved Nextendweb

    (@nextendweb)


    Hi @keycdn,
    it would be great if you could add a filter into your set_cache method:

        public static function set_cache($data) {
    
            // check if empty
            if ( empty($data) ) {
                return '';
            }
    
            $data = apply_filters('cache_enabled_before_minify', $data);
    
            // store as asset
            call_user_func(
                array(
                    self::$disk,
                    'store_asset'
                ),
                self::_minify_cache($data)
            );
    
            return $data;
        }

    It would allow plugin developers to modify the response before it is cached. Autoptimize contains the same filter with the name autoptimize_filter_html_before_minify.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thank you for the feedback. We’ll look into this for a future release.

    Meanwhile, you can disable Cache Enablers minify feature and use Autoptimize additionally. Both plugins work very well together and you should then be able to use Autoptimizes filter?

    Thread Starter Nextendweb

    (@nextendweb)

    Thanks @sebastiankro! I’m the developer of Smart Slider 3 plugin and not a real user. Our plugin starts an output buffer too, but ours is on init action while yours is on template_redirect. Our changes should happen before your cache, so we should start our output buffer later. What works the best if we have a filter which we can subscribe and we can adjust the output when needed.

    I refered Autoptimize as we use their filter too.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter before cache’ is closed to new replies.