I think there’s a bug in either Polylang or ACF. If you have a relationship field on a page, that’s set to list just a single custom post type, the field’s value gets saved to database, but after a page reload it appears as if it hasn’t been saved.
You can circumvent the issue by activating that custom post type in Polylang settings for translation, but if you don’t want to translate the particular CPT, this is not really optimal.
I’m actually facing the exact same issue! Also weird is that when loading the field, no “non-translatable” CPT posts are visible, but when doing AJAX request, they become visible. After saving, nothing seems to be selected but in post_meta I can see that a non-translatable post is selected.
Did some further debugging, apparently the relationship fields results use wp_query with “post__in” parameters with proper IDs, hence I feel like this should work out of the box but for some reason stays hidden.
I’ve come to a conclusion that the issue is a polylang issue rather than ACF issue. If one is using only “post__in” and “post_type” in wp_query, it shouldn’t make a difference in which language the request is made in as we has the IDs. Alternative solution would be to change ACF Core class-acf-field-relationship.php to iterate over every saved ID and map its content to a new array with “get_post”. “get_posts” with “post__in” does not work but “get_post” with single ID works.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
For anyone keeping up with my @wp_acf adventure today I actually made some progress with "ACF Shortcake" that mashes together the functionality of Shortcake and ACF Field groups inside ACF WYSIWYG fields.