Skip Navigation

[Resuelto] Get related posts by language (Polylang)

This support ticket is created hace 3 años, 2 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Valeriia hace 3 años, 2 meses.

Asistido por: Minesh.

Autor
Mensajes
#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

Idiomas: Inglés (English )

Zona horaria: 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 🙂