Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 多段式URL段塞无法正常工作_Php_Wordpress_Github_Plugins_Polylang - Fatal编程技术网

Php 多段式URL段塞无法正常工作

Php 多段式URL段塞无法正常工作,php,wordpress,github,plugins,polylang,Php,Wordpress,Github,Plugins,Polylang,我正在使用Polylang wordpress插件将我的网站转换成多种语言 在免费版本中,不允许翻译permalinks中的category_base或Tags slug 因此,我试图找到一个解决方案,我参与了插件 为此,我安装了插件,并在function.php中输入了以下代码段: add_filter( 'pll_translated_taxonomy_rewrite_slugs', function( $taxonomy_translated_slugs ) { $taxonom

我正在使用Polylang wordpress插件将我的网站转换成多种语言

在免费版本中,不允许翻译permalinks中的category_base或Tags slug

因此,我试图找到一个解决方案,我参与了插件

为此,我安装了插件,并在function.php中输入了以下代码段:

add_filter( 'pll_translated_taxonomy_rewrite_slugs', function( $taxonomy_translated_slugs ) 
{
    $taxonomy_translated_slugs = array(

        // tax_name
        'category' => array(
            'it' => 'categoria',
            'en' => 'category',
        )

    );

    return $taxonomy_translated_slugs;
});
我使用的代码片段在插件自述中找到:

我更新了Permalinks,现在当我更改语言时,url中的slug似乎发生了变化

但是我注意到,在HTML代码中,HREFLANG标记有一个问题,没有显示正确的URL

正确的URL是:

IT:Mydomain.com/categoria/xxxxxxx

EN:Mydomain.com/EN/category/yyyyyy

要查看html代码中的HREFLANG标记,我发现自己:

<link rel = "alternate" href = "Mydomain.com/xxxxxxx" hreflang = "it" />
<link rel = "alternate" href = "Mydomain.com/en/yyyyyy" hreflang = "en" />

因此,鼻涕虫“类别”和“类别”被消除

语言切换器小部件中的链接也有同样的问题

为什么不同时更新这些元素