• All the API calls made by the plugin fail when using WPML with several domains when the plugin is trying to purge_cage (for example) on a secondary domain.

    Imagine this scenario:
    – Website with WPML and 3 domains:
    – english.co.uk (main domain used for wp-admin)
    – portuguese.pt
    – french.fr
    – All the domains are active on the same Cloudflare account.
    – The plugin is installed and the domain is set on option cloudflare_cached_domain_name (this will be the main english.co.uk, of course)
    – The plugin gets the Zone Tag (ID) needed for the API calls using getZoneTag() that gets the main domain name as an argument
    – The plugin then uses that Tag to build the API call URL

    Problem:
    – The cloudflare plugin needs to use the correct Zone ID on secondary domains

    Solution:
    – In theory we could hook into option_cloudflare_cached_domain_name and return the current domain, so that the getZoneTag() function uses that domain to fetch the Zone ID
    – I’ve done this, and when you do get_option(‘cloudflare_cached_domain_name’) on a secondary domain it does returns the correct domain and not the main one, but I’m still getting 400 Bad Request API errors on the error_log

    GIST:
    https://gist.github.com/webdados/00942124f355d1a3c9f0542eca01757b

Viewing 1 replies (of 1 total)
  • Thread Starter Marco Almeida | Webdados

    (@webdados)

    Well, actually the errors stopped, so the filter should be doing its job.

    I really would like some collaboration between Cloudflare and WPML to get this into one of the plugins, done the right way.

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with WPML with multiple domains’ is closed to new replies.