After working around the duplication problem, next problem appeared.
The entered values in the fields of the new fieldgroup were not saved to database. This happened in both languages. They showed up in POST-request but the values were not saved. Only after disabling and re-enabling the WPML plugin, suddenly the saving was successful.
_acfchanged=1
_acfnonce=ac331c84cb
acf[field_53c50f46a677a]=asdasd
action=editpost
...
Maybe the combination WPML 3.1.6 and ACF Pro 5.0.0 is not yet ready for a production site, too bad for my client 🙁
WP 3.8.3, ACF PRO 5.0.0, WPML 3.1.6
I now have the clients site again in a state where ACF fields are visible in POST-request but actually not saved to database.
What can I do to track down the problem and/or provide debug-information?
Looked into this a bit more now, and it appears that the ACF PRO action save_post
in forms/post.php
is never called in the current state of my website here.
Edit: Seems to be different, still testing…
Edit 2: Seems to be problem around suppress_filter
.
With suppress_filter=false
and WPML active, trying to get a field in _acf_get_field_by_key()
does not return data.
If I change _acf_get_field_by_key() to suppress_filter=true, it looks like the correct post is returned by get_posts() but it actually is the opposite language, so a query with acf_field_key=field_1 returns a post with post_name=field_2, weird.
Example log with suppress_filter=true
acf/api/api-field.php/acf_get_field
$selector=field_53c599718b60c
$k=key
$v=field_53c599718b60c
returns a $field
with
$field[ID]=4032 (wrong language)
$field[label]=Adresse (wrong language)
$field[key]=field_53c5986bcd16e
Note the not matching key.
Hi @thomask
Thanks for the info. I have fixed some WPML bugs in the latest build 5.0.3.
Can you please update and test the issue again?
Quick results with 5.0.3, saving fields is still not working as expected, behaviour is different though. Will give more feedback as soon as I can test more.
Short update, it appears that values are saved to and read from the wrong language with 5.0.3 and before.
Have a fieldgroup in main language with field 1 and field 2. Added a translation of this fieldgroup in secondary language, with field 1 only.
Now saving values in field 1 works in both languages. But if I enter something in field 2 in main language it does not get saved, field 2 stays empty.
I think that’s because field 2 does not exist in translation of fieldgroup and so the value can’t be saved.
This problem usually won’t be noticed if main language and translation have same fields. Everything looks fine, but actually values are both saved to and read from wrong places.
This observation matches the above described behaviour with the not matching key in my log.
Edit: I don’t know why this topic is marked as solved, it is not.
Can you confirm/reproduce that values are saved to wrong language?
I confirm that in version 5.0.8 problem still exist. It looks exactly that “thomask” described above. Can we look forward to solution of that?
For me it looks like that:
I had the main content in the PL language. Then I`ve copied field groups and pages to 2 new languages- EN and CS.
When I save the content in PL language- it saves normally, but when Im trying to save it in 2 new langueages- it doesn
t save.
After disabling for a moment WPML content was saving normally in additional languages. Enabling WPML stopped saving.
At the moment the combination of ACF PRO and WPML is not ready for production sites at all.
And I don’t think this will change in near future, too bad.
WPML support says: Drop ACF, use Types, but current version of Types also has many problems.
Using old school standard WordPress custom fields for now, ugly backend but at least reliable.
I would like to reopen this issue, since this is still a problem.
Issue: Using the field type Post object
in ACF Pro while the plugin WPML Multilingual CMS is active, does not find any post. Filtering doesn’t seem to help in any way.
I know “…I don’t think this will change in near future…”, but it has been a year and I think many people struggle with this issue. So I hope we can reopen this issue.
The problem still has something to do with suppress_filter
I think. While the element suppress_filter => false
and the plugin WPML is active, the function _acf_get_field_by_key()
does not return any data (posts, pages, cpt’s, …). If I remove the element suppress_filter
in the function _acf_get_field_by_key()
, I get the opposite language post.
I hope you guys can find a solution. Of course I’ll look for it myself and keep you guys updated.
Versions:
WordPress 4.3
ACF Pro 5.2.9
WPML 3.2.4
The topic ‘Values are not always saved, WPML’ is closed to new replies.
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.