If you use the multilingual plugin "WPML" and configure it so that the different languages are accessible via separate domains or subdomains, problems can occur when using the performance plugin "WP Fastest Cache" at the same time. This is because it does not take the different languages into account when defining the page cache. As a result, the same content may be displayed under a different domain because the cache directory is identical.
To ensure that the different languages are distinguished when building the cache, you only need to make a change in one place in "WP Fastest Cache". The relevant location can be found in the file:
/wp-content/plugins/wp-fastest-cache/inc/cache.php
Here, for example, you can change the lines:
$this->cacheFilePath = $this->cacheFilePath ? rtrim($this->cacheFilePath, "/")."/" : "";
$this->cacheFilePath = $this->cacheFilePath ? rtrim($this->cacheFilePath, "/")."/" : ""; //$this->cacheFilePath = str_replace("/cache/all//", "/cache/all/", $this->cacheFilePath);
and replace them with
if($this->isPluginActive('sitepress-multilingual-cms/sitepress.php')){ if($this->isPluginActive('sitepress-multilingual-cms/sitepress.php')){
$current_language = apply_filters('wpml_current_language', false);
$this->cacheFilePath = str_replace('/cache/all/', '/cache/all/' . $current_language . '/', $this->cacheFilePath);
} else {
$this->cacheFilePath = $this->cacheFilePath ? rtrim($this->cacheFilePath, "/")."/" : "";
$this->cacheFilePath = str_replace("/cache/all//", "/cache/all/", $this->cacheFilePath);
}
This gives each language its own cache path, and everything works smoothly again.
