- 状态
- 已由作者解决
- 相关插件/主题
- WPRentals
- 主题标签
- Compatibility
问题概述
将WPRentals 主题与 WPML 搭配使用时,您可能会遇到房产页面上的分类法项显示为错误语言的问题。发生这种情况是因为该主题会缓存分类法数据,导致分类项显示为最后一次清除缓存时的语言。
临时解决方法
在继续操作之前,请确保您的站点有完整站点备份。
- 打开 …/wp-content/themes/wprentals/libs/taxonomy_functions/taxonomy_transients_functions.php 文件。
- 找到第 35 行。
- 替换:
// Create unique key based on taxonomy and args $args_hash = md5(serialize($args));
- 替换为:
// Create unique key based on taxonomy and args $args_hash = md5(serialize($args)); // WPML Workaround for compsupp-8069 if ( class_exists('Sitepress') ) { $current_lang = apply_filters( 'wpml_current_language', NULL ); $args_hash .= '_' . $current_lang; }
这会将当前语言代码附加到 transient 键,确保每种语言都有自己缓存的分类法术语。