I was hoping the old discussion would point you in the right direction because, to be honest, I don’t know anything about using translation plugins like Polylang or WPML. I generally use Multilingual press and I don’t generally use choice type fields for content that will be displayed even then. All of the choice type fields I use are for making decisions not related to content to be displayed.
Update: After testing on a staging environment, I noticed that using a Clone field within Flexible Content causes issues. Not the error perse, but it starts incorrectly showing the fields content on the front-end.
This is of course related to translating with WPML, it works fine without WPML.
Any workaround for this? Suggestions?
Recently got this problem installing WPML on a ACF heavy site. From reading this topic, it seems to mess up primarily with Repeater Fields/Flexible content?
Any way to solve this yet?
This is one of the many reasons that I do not use WPML and I use https://multilingualpress.org/ instead.
Still no answer? This puzzles me, support was always great with ACF Pro.
WPML has released a minor update to address this issue. It did so, partly. We get no longer that JSON-like stuff and the “Array array” output.
But: Changing fields in one language messes up fields in another language. I’m not sure what role ACF or the bridge plugin plays in that regard, but it’s a complete mess, a nightmare so to speak.
I’m really reaching out to the ACF team for some insight on this.
Cheers.
Hi,
Having the same problem (except for the sage9 part).
WPML + ACF – getting repeater field from a group.
is_array($repeaterField) returns true.
sizeof($repeaterField) and count($repeaterField) triggers a notice:
count(): Parameter must be an array or an object that implements Countable
Help would be highly appreciated 🙂
Hi Kenny,
in our case this bug seems to be caused by the WPML ACF “Glue” Plugin…we deactivated and now it works gladfully. thank you!
best wishes
Any updates on the topic? We had to roll back plugin versions and lost quite some data. Not sure when we can get back into regular upgrade path and how to deal with the issue in general. Corresponding request send to WPML.
Hi There, not really. ACF Custom fields are really a mess with WPML in my opinion. But recently we switched over to native gutenburg blocks and WPML and Gutenburg blocks work way better than our old setup….
A note; the solution here is for translating the ACF input field labels. Not the content. That’s an important difference. If you’re trying to translate the content, then you don’t need anything except the regular Polylang or WPML Plugin functionality. If the strings on the website are fixed in the code and untranslatable, then that’s a different issue. I’d be happy to help directly if you need consultancy in that area.
Both WPML and Polylang work fine with ACF. I’m confused about what you’re trying to achieve. Can you send me a screenshot of the strings as they appear in the front end of the website, which you’re trying to translate?
Ok thank you. They are not cooperating with this developer anymore. I think it’s best they uninstall Polylang and buy WPML?
OK, for those who wants to achieve this, i found a solution which is so far working without a problem :
You’ll need to use ACF post 2 Post (https://wordpress.org/plugins/post-2-post-for-acf/)
ACFP2P have a hook that is called after each related post is updated, all you need to do is to use the WPML hook “wpml_admin_make_post_duplicates” on each posts, thus updating your duplicated post data:
add_action(‘acf/post2post/relationship_updated’, ‘my_post_updated_action’);
function my_post_updated_action($post_id) {
// $post_id == the post ID that was updated
// do something after the related post is updated
do_action( ‘wpml_admin_make_post_duplicates’, $post_id );
}
Hi John!
We are running into another problem…
We are using WPML. Everything works fine on the default language (English). But when i try to show the artist related works on the secondary language (French) nothing is shown..
The var_dump of : $arts = get_field(‘art_artist’); where “art_artist” is my relationship field return a value in the default language, but returns NULL in the secondary language.
All the Artworks are translated (duplicated).
Hope you can help me once again!
Thanks!
I had the same issue without using WPML or other plugins.
The Problem was a field group (A) i used in another group (B) via clone.
After deleting (A), the error occurs, because (B) was referencing a deleted field group. After deleting the cloned group from (B) the error disappears and everything was fine.
founded a solution here with getting original_id over here
but if someone have a better id !
The line that’s causing your issue indicates that the field group does not have a key, which should be impossible.
As far as the duplicated groups for wpml and clone field. I don’t know how this works, but it could be that the duplicated groups that include cloned groups the key of the cloned group was not set correctly. I would try to edit these duplicated groups and check the clone field, maybe updating these will work?
Hello,
after many investigation, i found what is making this trouble !
its a custom code i used to add a .html extension to all my pages & customs posts.
but i can not figure what in this code is creating this trouble :s
my function
function custom_post_permalink ($post_link) {
global $post;
if($post) {
$type = get_post_type($post->ID);
$post_type_data = get_post_type_object( $type );
$post_type_slug = $post_type_data->rewrite['slug'];
$post_type_slug_translated = apply_filters( 'wpml_get_translated_slug', $post_type_slug, $type);
$translated_home_url = apply_filters( 'wpml_home_url', home_url());
$be_current_lang = apply_filters( 'wpml_current_language', NULL );
if($be_current_lang=='fr'){
return $translated_home_url . $post_type_slug_translated . '/' . $post->post_name . '.html';
} else {
return $translated_home_url .'/'. $post_type_slug_translated . '/' . $post->post_name . '.html';
}
}
}
add_filter('post_type_link', 'custom_post_permalink');
Thanks in advance for your help
Thanks for the info.
I’ve got over 60 field groups, some of them are flexible fields with several of the other field groups as clones inside their flexible field layouts.
Notices started to pop up after I’ve duplicated the field groups via WPML (WordPress Multilingual Plugin) functionality to make the field groups available in other languages.
I did not consider the hierarchy of the fields while duplicating them. Meaning: I should have duplicated the ones which are used as clones first. And only after duplicating all the basic field groups I should have started with duplicating the rather complex ones.
–> Might be the reason why I get these notices now.
Luckily I was able to figure it out this morning. For whatever reason WPML + ACF Pro needs a wopping 1GB of PHP memory limit with all accompanying settings upped to infinity (PHP / Apache / nginx timeouts etc.)
But then it works. Most of the time.
This doesn’t work at all. I found that even ex- / importing field groups, without touching / manipulating the JSON file, results in WordPress throwing an error message, field groups missing all together, and a messed up database.
What a mess, WPML is such a piece of crap. Open for suggestions.
The IDs used for groups, fields are generated using uniqid() https://www.php.net/manual/en/function.uniqid.php. This function uses the system time to generate an id. Increment any value in the key will not be guaranteed to make it unique. It would be better to append a value to the existing key, for example
layout_5cc01670...a
layout_5cc01670...b
layout_5cc01670...c
as far as searching and replacing, that would depend on what you are searching and replacing? I don’t know anything about how WPML translates a field group, so I’m not sure I could help you with that.
I am also experiencing this out of the blue phenomenon on one of my installs (creating new fields and not being able to save their data). At first I thought it was WPML causing this, however upon their investigation, they are suggesting that ACF is the culprit. Not sure what to do from here, tried the Beta version and still no luck. I am manually updating the DB to perform customer requests in the meantime, but of course this is not a viable solution.
I have removed plugins, deactivated / reactivated ACF, scoured for answers, implemented suggestions etc. etc. and same results.
Thank you.
Hi @jonathan
I have the same issue then @davewardle, except I am not using forms. I managed to set up the field labels and WPML is seeing the strings and I am able to translate the labels. My question is what can get lost when updating acf? If I keep my ields saved as php plus the translation mo and po files it would be a matter of reuploading these, or what are the risks?
Sorry, still new at WordPress development.
I’m getting an error in the user_set_sync_preferences
function in acfml/classes/class-wpml-acf-field-settings.php
. The error occurs on this line:
$field_post_content['wpml_cf_preferences'] = $field_preferences;
When I added some debug logging, I noticed that the $field_post_content
is an empty array because $field_post->post_content
is blank. When I log $field_post
, it shows the page post itself, not the custom field post.
Any tips on how to get this fixed?
I have the wpml_cf_preferences
field set in all of my fields (i.e., I can see the field set in my acf-json files). Since I’m entering the $field_object['wpml_cf_preferences'] != $field_preferences
conditional, my wpml_cf_preferences
field from the acf-json file must not be matching the $field_preferences
variable, but where is this $field_preferences variable set? Is this caused by differences in the acf-json file and the database? I don’t see this issue in my local instance, but when I deploy to my staging environment (with the acf-json files in my git repo), I notice the issue.
ACF PRO version: 5.7.10
ACFML version: 1.1
WPML Multilingual CMS version: 4.2.4.1
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.