- 状态
- 已解决
- 报告针对
- WPML Multilingual CMS 4.4.8
- 解决于
- 4.4.9
问题概述
在某些情况下,具有相似别名的文章和页面可能会显示错误的内容。
例如,如果您有一个名为 Books 的文章类型,其内容位于 http://example.com/book/title/,并且您还有一篇具有相同别名的文章,即 http://example.com/title/,那么在访问这些 URL 时,您将看到错误的内容。
临时解决方法
我们的开发人员正在努力修复此问题。
作为临时解决方法:
- 前往 plugins/sitepress-multilingual-cms/classes/query-filtering/class-wpml-404-guess.php 第 36 行
- 将
public function guess_cpt_by_name( $name, $query ) { $type = $query->get( 'post_type' ); $ret = array( $name, $type, false ); - 替换为
public function guess_cpt_by_name( $name, $query ) { $type = $query->get( 'post_type' ); if (empty($type)) { $type = !empty($query->get( 'pagename' )) ? 'page' : 'post'; } $ret = array( $name, $type, false );