WPML
状态
已由作者解决
相关插件/主题
All in One SEO

问题概述

当使用 All in One SEO 和 WPML 并且启用了调整ID以实现多语言功能选项(位于 WPML语言页面)时,category-sitemap.xml 文件将包含默认语言的重复分类。次要语言的分类不会显示。

临时解决方法

需要在 All in One SEO 的代码库中进行永久性修复,但在此期间,您可以按照以下步骤使用此问题的临时解决方法:


  1. 打开 wp-content/plugins/all-in-one-seo-pack/app/Common/Sitemap/Query.php 文件

  2. 搜索 terms 方法(大约在第 227 行)

  3. 将以下临时解决方法添加到该方法的开头:
    public function terms( $taxonomy, $additionalArgs = [] ) {
    
    //WPML workaround
    if (class_exists('SitePress')) {
    global $sitepress_settings;
    // Before building the sitemap and as we are on front-end make sure links aren't translated.
    // The setting should not be updated in DB.
    $sitepress_settings['auto_adjust_ids'] = 0;
    }


  4. 打开 category-sitemap.xml 文件(yourwebsite.com/category-sitemap.xml)并刷新页面

后续步骤

我们已经向 AIOSEO 团队告知了此问题,并且我们确信他们会很快解决该问题。如果您想查看进度,可以通过他们的支持论坛与他们联系。

所有已知问题 →