• Resolved Neyl

    (@neyl8)


    Hello,

    is your plugin compatible with WPML plugin?

    Mostly meaning, if we have set up multiple languages on site, would clearing site cache clear it across all languages, or just the current one? Would it work differently based on whether the setting is that each language has its own domain / subdomain or just sub directory?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Anonymous User 16850768

    (@anonymized-16850768)

    It would be compatible in caching the languages separately. I haven’t been able to test this exact plugin yet in regards to clearing the cache. On the top of my head if the language is a subdirectory (e.g. https://www.example.com/fr/about/) then it will be cleared when the site cache is cleared.

    If the language is a subdomain (e.g. https://fr.example.com/about/) then I’m unsure at this time what would occur as I’m not familiar how WPML handles that configuration. If it’s not cleared when the site cache is cleared then it’d be easy to add a function to handle this, which I’d be happy to provide.

    I’d love to get your feedback after you’re able to test it as that would help me and other users.

    Hello!

    Same problem here.

    Using WPML with “different domain per language” settings (example.hu, example.com, example.de) not clearing the site cache in all languages. Would you be so kind to give me some tips how to solve that, or could you add a function/button which clear all cache?

    Thanks!

    Anonymous User 16850768

    (@anonymized-16850768)

    Thanks for your feedback to my inquiry in my first reply, @ivancza. I thought this would be the case when mapping different domains to each language and am glad you’ve confirmed this.

    I’ll have to think about if and how I would like to add this to the core. In the meantime you can extend Cache Enabler to resolve this by adding the following snippet to your website, like in your functions.php file:

    add_action( 'cache_enabler_site_cache_cleared', 'cache_enabler_clear_wpml_sites_cache' );
    
    function cache_enabler_clear_wpml_sites_cache() {
    
        // language site(s) when the WPML "A different domain per language" setting is enabled (do not include primary site)
        $wpml_sites = array(
            'https://example.hu',
            'https://example.de',
        );
    
        // clear each language site cache after primary site cache is cleared
        foreach ( $wpml_sites as $wpml_site ) {
            $clear_type = 'subpages';
    
            Cache_Enabler::clear_page_cache_by_url( $wpml_site, $clear_type );
        }
    }

    The above snippet will clear each language site cache after the primary site cache is cleared, whether that is done manually, like through the WordPress admin bar button, or automatically if an enabled Cache Enabler setting triggers this.

    Thanks for the quick answer!

    I tried it, but something still doesn’t work. Maybe I should look elsewhere for the problem.

    Anonymous User 16850768

    (@anonymized-16850768)

    You’re welcome! I tested the snippet provided again and it works successfully on my installation. Are you using the latest version of Cache Enabler?

    If yes, are the sites in the $wpml_sites array exactly as they are cached in wp-content/cache/cache-enabler? The scheme needs to be included in addition to the host being exactly as cached.

    Hello!

    Sorry I haven’t given any feedback so far. Works perfectly, thanks!

    Anonymous User 16850768

    (@anonymized-16850768)

    Excellent! Thanks for letting me know. If you haven’t already leaving a review is always appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Compatibility with WPML’ is closed to new replies.