Skip Navigation

[Resolved] Get related posts by language (Polylang)

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Valeriia 3 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#2181585

Hi,

I'm using Toolset with Polylang.

When using get_posts I can retrieve posts by language simply adding 'lang' => 'en' to arguments.

Is there any way I can modify toolset_get_related_posts() or apply a filter to be able to do the same?

Thank you

#2181797

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I dont think that there is a argument "lang" accepted by the post relationship function toolset_get_related_posts().

But you should try to get related posts using the WP_Query way where you should try to hook in the argument "lang" and check if that works:
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/#wp_query-argument-for-querying-by-related-posts

#2181983

It worked, thanks.

Have a nice day 🙂