This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Author Posts
August 22, 2019 at 6:54 pm #4442289

matthewS-6

I am trying to:

I have created a relationship field on the "product" CPT of my English-Canada site. I want to put a relationship field that only allows me to choose from En-US (English USA) products. When a US customer goes to a Canadian product, I want to show a list of Products available in the US. I will be using MaxMind GeoIP detection to determine the request's country of origin.

I have created an ACF Field Group and added a "Relationship" field but it obviously only shows the current language posts. So, Canada-English only shows Canada-English Products. Ideally I'd like to lock this down to ONLY show English-USA products/post/content... even though I'm on the Canada site.

Is there a filter that I can tie into that I can send a hardcoded ICL_LANGUGE id to or something? Thanks for your time!

Link to a page where the issue can be seen:
N/A it's in the Admin.

I expected to see:
US List of Products on the Canada site

Instead, I got:
Canada list of Products on the Canada site.

August 23, 2019 at 6:38 am #4444323

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

Ideally I'd like to lock this down to ONLY show English-USA products/post/content... even though I'm on the Canada site.

If I got this request right, you would like to show for example English content on German language (example for an illustration only)?

I do not think it is possible, because that will counteract how WPML works - by showing content from language on which the visitor is currently on, while having ACF relationship field complicates things up.

I wondering whether it is related to this perhaps:
https://wpml.org/forums/topic/display-blog-posts-from-other-language-not-on-blog-page-and-no-duplicates/#post-1323225

You can also check our API, perhaps finding what you need there:
https://wpml.org/documentation/support/wpml-coding-api/

You could also consider the following:
https://wpml.org/contractors/

Regards,
Bruno Kos