• Hi,

    I try to set up a custom cache bypass logic based on the example code I found in the documentation.

    add_filter( 'cache_enabler_bypass_cache', 'filter_cache_enabler_bypass_cache' );
    
    function filter_cache_enabler_bypass_cache( $bypass_cache ) {
    
        $post_type = get_post_type();
    
        if ( $post_type === 'news' ) {
            $bypass_cache = true;
        }
    
        return $bypass_cache;
    }

    I added the above code to functions.php in my WP child theme, but I found that for some reason it never runs.

    After a lot of investigation I think the problem is, that the

    apply_filters( 'cache_enabler_bypass_cache', bool $bypass_cache = Cache_Enabler_Engine::is_excluded() );

    code in the plugin runs before my filter function gets added by add_filter().

    Can you please help in how/where should I register my function with add_filter() to make this work properly?

    Thanks in advance!

  • The topic ‘cache_enabler_bypass_cache filter not working’ is closed to new replies.