I created a custom field (using ACF Plugin) called "my_custom_field". Then I use this code to get the value for that custom field which works fine:
echo $output = get_post_meta($data['post_id'], "my_custom_field", true);
My site have two languages (french and spanish). I use WPML for translations.
Problem is that the $output always shows the value for the default language (french) even if the $output is loaded and printed in an "spanish" page.
I guess that I need to add something else in my code to detect the language and show the $output accordingly.
2
Answers
this fixed the problem:
To make the ACF field translatable for WPML you need to install the ACFML plugin that you can download from your account on the WPML website.
With this plugin, you can make ACF fields translatable. More you can read inside official documentation: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/