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.
Let me know.
Regards,
Drazen
The topic ‘[Closed] I am using Elementor, ACF and WPML for a multilingual website, and have issues with custom filter’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.