Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 10:00 8:00 – 10:00 8:00 – 13:00 8:00 – 13:00 9:00 – 13:00 -
- 11:00 – 17:00 11:00 – 17:00 14:00 – 17:00 13:00 – 17:00 13:00 – 18:00 -

Supporter timezone: America/New_York (GMT-05:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Lauren 7 months, 3 weeks ago.

Assisted by: Lauren.

Author Posts
April 17, 2024 at 4:44 pm #15534135

Andreas

I have tracked down an issue in the wpml-code and I would like to suggest a code patch

April 17, 2024 at 8:47 pm #15534898

Andreas

I found this "hack" to work nicely at the moment.

add_action('switch_blog', function () {
      $container = \WPML\Container\Container::get_instance();
      foreach (get_declared_classes() as $className) {
        if (
          is_subclass_of($className, \WPML_Element_Translation::class)
        ) {
          try {
            $translation = $container->make($className);
            $translation->reload();
          } catch (\Exception $e) {
            continue;
          }
        }
      }
    });

But I think in the long term it would be better if that could be integrated into wpml. Especially since wpml could use private APIs to not only clear the cache, but keep it for when the blog is switched back.

April 19, 2024 at 3:29 pm #15544529

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

I have sent your suggestions to our developers for review and will update here if I find out that they will implement it or not. This could take some time for reivew, so I appreciate your patience in advance.