Skip Navigation

[Resolved] Relationships between posts of different languages

This support ticket is created 3 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 19 replies, has 2 voices.

Last updated by caroleM-4 3 years ago.

Assisted by: Luo Yang.

Author
Posts
#2208745

Thanks a lot Luo and please excuse me for insisting so much on that but replacing Toolset relationships with another kind of linkage is not something I wish to do before I am absolutely sure it's impossible to get them working as needed for this project because I will loose a lot of comfort doing so.

On my side, i did a bit more testing and discovered that I could manage to connect, disconnect and display relationships correctly in the backend using :

function disable_relationships_filtering( $query ) {
  $query->query_vars['suppress_filters'] = true;
  if ( is_admin() && !$query->is_main_query()) {
  	do_action( 'wpml_switch_language', "fr" );
  }
}
add_action( 'pre_get_posts', 'disable_relationships_filtering' );

But that's really not an ideal solution so it would be great if I could find a workaround that would only affect relationships related queries while not needing to switch language along the way.

Have a nice weekend.

#2210755

Here is the feedback from our developers:
It is not possible within the Types plugin, and this is a limitation of WPML option "Translatable - use translation if available or fallback to default language", we don't have other existed workaround for it.

If you agree, we can take it as a feature request.

#2210951

Well, I think that being able to allow relationships to be set and displayed regardless of post languages may be useful in many cases so taking it as a feature request would be a good thing even if useless for me in the context of the current project which has to go live in December.

So if I am not misunderstanding, actually my options are :

1) Completely replace Toolset Relationships for linking posts (custom code, other plugin, etc.)
2) Try to go with the solution I mentioned in answer #2208745 but I will then probably get stuck for frontend display
3) Work with both post types set as not translatable and use a custom field to filter them by language

I guess I should give a try to the third option before replacing Toolset relationships even if I would then probably have to solve a few problems with frontend display.

Could you please tell me if relationships would work correctly this way at all levels even though many of the posts have been created as secondary language posts and have no default language translation ?

#2211461

Please check the document I mentioned above:
https://toolset.com/course-lesson/translating-related-content/

The post type relationship works when you setup both post types as "Translatable - only show translated items", it works when you connect posts in same language.

Hope it is clear

#2212699

Well, I am not sure it's completely clear but at least enough for me to understand that relationships are useless in my context and that the best thing I can do now is stop wasting time on it.

Thanks for your help and patience.