网址为?lang = any lang时,自定义add_rewrite_rule在WPML中不起作用,但在其他WPML网址类型中起作用

时间:2019-07-15 07:15:23

标签: wordpress url-rewriting wpml

WPML不适用于自定义add_rewrite_rule,当我尝试使用?lang = ar 时,它将返回404错误

但是它正在与其他网址一起使用

WPML网址设置Formate =>?lang = ar

http://example.com/page_slug/category/radio/。 ==>工作正常 http://example.com/page_slug/category/radio/?lang=ar ==>不起作用

其他URL formate运行正常 http://example.com/ar/page_slug/category/radio/ ==>工作正常 http://ar.example.com/page_slug/category/radio/ ==>工作正常

我的代码:

$page_id = 2;

$link = get_permalink($page_id);

add_rewrite_rule( "$link/category/([^/]+)/?$", 'index.php?page_id=' . $id . '&rtcl_category=$matches[1]', 'top' );

WPML网址设置Formate =>?lang = ar

http://example.com/page_slug/category/radio/。 ==>工作正常 http://example.com/page_slug/category/radio/?lang=ar ==>不起作用

其他URL formate运行正常 http://example.com/ar/page_slug/category/radio/ ==>工作正常 http://ar.example.com/page_slug/category/radio/ ==>工作正常

错误消息:找不到页面404错误

0 个答案:

没有答案