Skip Navigation

Resolved

Resolved in: WPML 4.6.7

Topic Tags: Compatibility

Overview of the issue

If you are using LiteSpeed Cache plugin, you may encounter an issue translating posts. Specifically, when users create and translate a new post, the translated post does not retain the category from the original post.

Workaround

Option 1

  • Go to Litespeed cache > Cache > Purge > Auto Purge Rules For Publish/Update page.
  • Disable the Term archive (include category, tag, and tax) option.

Or:

Option 2

Please, make sure of having a full backup of your site before proceeding.

  • Open …/wp-content/plugins/litespeed-cache/src/purge.cls.php file
  • Look for line 1172.
  • Change:
    1
    $terms = get_the_terms($post_id, $tax);
  • For
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    // WPML Workaround for compsupp-6805
    $terms = '';
     
    if( class_exists('SitePress') ){
        $default_language = apply_filters('wpml_default_language', NULL );
        $current_language = apply_filters('wpml_current_language', NULL );
         
        if ( $default_language === $current_language ) {
            $terms = get_the_terms($post_id, $tax);
        }
    } else {
        $terms = get_the_terms($post_id, $tax);
    }