Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 504799

Problem with WPML with multiple domains

$
0
0

Replies: 0

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 all articles
Browse latest Browse all 504799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>