Home›Support›English Support›[Waiting for user feedback] I am using Elementor, ACF and WPML for a multilingual website, and have issues with custom filter
[Waiting for user feedback] I am using Elementor, ACF and WPML for a multilingual website, and have issues with custom filter
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
I am using Elementor, ACF, and WPML for a multilingual website. I have a custom post type called 'officials' connected to product categories. These officials are salespeople responsible for specific product categories. On category pages, I display these salespeople using an Elementor loop with a custom filter. In the main language (Hebrew), it works well, but in the English version, the query to retrieve connected salespeople returns empty. I attempted debugging, but the query still returns nothing. The code snippet I used is:
...
elseif (is_product_category()) {
$term_id = get_queried_object_id();
Symptoms:
The query to retrieve connected salespeople in the English version of the site returns empty, despite the connection being visually set in the admin.
Questions:
What am I doing wrong with the query in the English version?
Why does the query return empty for the English version but works in the main language?
As I can see from shared code you are getting original ID, while you should get translated ID of category. And then get translated post related to that translated category.
Thank you for answering. I tried both. The problem is that the function doesn't show any connections when in a translated language, as if they do not exist. I solved the problem by removing the connections between the original "officials" and their translations. Once I did this, everything started working as expected. It is obviously not the best solution, but it works.
Best,
Evgeny
If you need further help and want us to check further, please create a staging site, and minimize your custom code, best would be WP default theme, Elementor, ACF and WPML plugins active.