Skip to content Skip to sidebar

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.

This topic contains 1 reply, has 2 voices.

Last updated by Christopher Amirian 1 year, 10 months ago.

Author Posts
September 22, 2023 at 1:46 pm #14447379

armandB-4

Tell us what you are trying to do?
I'm trying to use WPML in conjunction with Advanced Custom Fields (ACF) on my website. Everything works fine when viewing content in our primary language, Dutch. However, when I switch to our secondary language, I encounter an error related to the acf_get_value function.

Is there any documentation that you are following?
I've reviewed the WPML documentation related to ACF integration and followed the recommended setup steps. I've also consulted the ACF documentation and online forums to ensure that I'm using the plugin correctly.

Is there a similar example that we can see?
The error message I receive is as follows:
( ! ) Notice: Function acf_get_value was called incorrectly. Advanced Custom Fields PRO - We detected one or more calls to fetch ACF field values before ACF has been initialized. This is not supported and can result in incorrectly formatted or missing data.

This error only appears when viewing the site in our secondary language.

What is the link to your site?
It's a local dev enviroment

Scherm­afbeelding 2023-09-22 om 15.40.12.png
September 25, 2023 at 6:11 am #14454447

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Before this ticket is assigned to one of my colleagues I will give the initial answer.

Would you please check and see if the code in question works with a minila installation?

- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except WPML and its add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

I also need to know if the issue happens only when you want to retrieve content from the options page or acf_get_value fails even with single custom posts?

Finally, I wonder if you can use an alternative function instead of acf_get_value and see if it works ok?

Thanks.

September 26, 2023 at 7:25 am #14463459

armandB-4

It was een issue with my theme, where I get the acf options but before ACF was rendered. So i've fixed it! Thanks!