WAIT: WPML Template using action hook called in every language

Templates that are supposed to run on an action hook, are executed despite the current site language.

This is especially unfortunate since it seems there is no clear loading order leading to the translated and the original template randomly showing up.

In the code, i found bricks/get_templates/query_vars filter which could be used to add the ā€˜suppress_filtersā€™ argument, which in theory should fix this issue. Can you maybe elaborate if this is a route you could tike in core?

1 Like

Hi @JUVO_Justin,

Could you please provide the exact replication steps for the issue? Hereā€™s what I did on my end:

  1. Created a section template.
  2. Assigned it to the entire website under theme conditions and set the hook name to ā€œbricks_after_headerā€.
  3. Translated the section template.
  4. On the site, only the relevant template shows up after the header (not both the original and the translation).

Could you clarify what you mean by ā€œTemplates that are supposed to run on an action hook, are executed despite the current site languageā€?

Hey,
what you did is nearly correct, only that the symptom is not that both show up, but a random one with the condition. In our experience, it was always the last edited one. Will provide a screencast later.