Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are using WPML and ACF on your website and encountering an issue where

get_fields()

in your PHP file returns FALSE when trying to retrieve fields set across different languages.
Solution:
1. If the issue occurs in the default language, disable WPML temporarily to check if the problem persists without it.
2. If the problem is in a secondary language, ensure that the pages are translated. Use the

wpml_object_id

hook to obtain the correct post ID for the translated post, which should allow you to retrieve the fields correctly. For more details on using this hook, visit https://wpml.org/wpml-hook/wpml_object_id/.

If this solution does not resolve your issue, or if it seems outdated or irrelevant to your specific case, we recommend opening a new support ticket. Additionally, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, please contact us through our support forum.

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.

Tagged: 

This topic contains 1 reply, has 0 voices.

Last updated by Dražen 1 week, 6 days ago.

Assisted by: Dražen.

Author Posts
March 12, 2025 at 8:35 am #16805519

williamc-41

Background of the issue:
In my website, hidden link, I created a product category and used ACF to create its fields. I set the same fields across languages in ACF. I am using WPML and trying to retrieve these fields using get_fields() in my PHP file.

Symptoms:
When using WPML, get_fields() in my PHP file returns FALSE.

Questions:
How can I retrieve ACF fields using get_fields() with WPML?
What settings should I adjust in WPML to make get_fields() work?

March 12, 2025 at 9:30 am #16805904

Dražen
Supporter

Languages: English (English )

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

Hello,

Thanks for contacting us.

1) If you are having issue in default language, please disable WPML and check if the issue still happens in default langauge.

2) If you are having an issue in the 2nd language, make sure you have translated pages if you are trying to get fields in the 2nd language.

Then, you should use wpml_object_id hook to get the correct post ID, in this case, the translated post ID, and show fields from that post.

- https://wpml.org/wpml-hook/wpml_object_id/

Regards,
Drazen