Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wowlayers

    (@wowlayers)

    @dilirity thanks for taking the time to write.

    In the end it seems WP Super Cache, creates separate folders for each domain, so my issue is resolved ??

    Thread Starter wowlayers

    (@wowlayers)

    I tried this filter, I am almost sure this is the one, but it doesn’t log anything.

    add_filter('wp_cache_served_cache_file', 'modify_served_cache_file', 10, 1);

    function modify_served_cache_file($cache_file) {
    // Inspect the cache file being served
    error_log("Serving cache file: " . $cache_file);

    // Modify the cache file path or manipulate its content if needed
    // Example: Read and replace content dynamically
    if (file_exists($cache_file)) {
    $cache_data = file_get_contents($cache_file);

    // Example: Replace the domain dynamically based on the request
    $current_domain = $_SERVER['HTTP_HOST'];
    $cached_domain = 'primary-domain.com'; // Replace with your cache domain

    // Replace domain in cached data
    $cache_data = str_replace($cached_domain, $current_domain, $cache_data);

    // Save the modified content back to the file (optional)
    file_put_contents($cache_file, $cache_data);
    }

    // Return the modified or original cache file path
    return $cache_file;
    }

    This is my WP_DEBUG Setup

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false ); // Prevents errors from displaying on the frontend
    @ini_set( 'log_errors', 1 );
    @ini_set( 'display_errors', 0 ); // Prevents errors from displaying on the frontend

    WP Super Cache is set to operate in Simple Mode.

    Any ideas would help ??

Viewing 2 replies - 1 through 2 (of 2 total)