• Resolved elexpress

    (@elexpress)


    Hello!

    I’m experiencing an issue with the WP Fastest Cache when using the add_filter() function in functions.php.

    I utilize an MU Plugin named buffer.php that buffers the entire WordPress process and captures the final output for manipulation. Here’s the code for it:

    <?php
    
    /**
     * Output Buffering
     *
     * Buffers the entire WP process, capturing the final output for manipulation.
     */
    
    ob_start();
    
    add_action('shutdown', function()
    {
        $final = '';
    
        // We'll need to get the number of ob levels we're in, so that we can iterate over each, collecting
        // that buffer's output into the final output.
        $levels = ob_get_level();
    
        for ($i = 0; $i < $levels; $i++)
    	{
    		$final .= ob_get_clean();
        }
    
        // Apply any filters to the final output
        echo apply_filters('final_output', $final);
    }, 0);
    

    In my functions.php, I’m using the buffer to manipulate HTML:

    add_filter('final_output', 'filter_badge', 10);

    The problem is, the cached version always shows the HTML content without executing the add_filter(). This happens regardless of whether I set the priority value to 8, 10 or 18.

    Has anyone else encountered this problem or could offer some guidance? I appreciate any help.

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP Fastest Cache not reflecting changes made with add_filter() in functions.php’ is closed to new replies.