问题概述
如果您正在使用 LiteSpeed Cache 插件,在翻译文章时可能会遇到问题。具体来说,当用户创建并翻译新建文章时,翻译后的文章不会保留原文章的分类。
临时解决方法
此问题已在 WPML 4.6.7 中修复。 更新即可在您的站点上解决此问题,因此只有在您还无法更新时,才需要此临时解决方法。
选项 1
- 前往 Litespeed cacheCachePurgeAuto Purge Rules For Publish/Update 页面。
- 禁用 Term archive (include category, tag, and tax) 选项。
选项 2
在继续操作之前,请确保对您的站点进行完整备份。- 打开 …/wp-content/plugins/litespeed-cache/src/purge.cls.php 文件
- 找到第 1172 行。
- 将:
$terms = get_the_terms($post_id, $tax);
- 更改为:
// 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); }