1

我目前正在研究wordpress。URL 0f 站点是这样的

example.com/dashboard-form/?din=random12

我希望网址是这样的

example.com/dashboard-form/random

提前致谢

4

1 回答 1

1

在初始化时添加:

注册您的自定义变量(问题中的“din”)

add_rewrite_tag('%mycustomvar%','([^&]+)');

创建重写规则:

add_rewrite_rule('^product/([0-9]{1,})/?','index.php?p=4&mycustomvar=$matches[1]','top')

更多内容请参考以下链接:

https://wordpress.stackexchange.com/questions/48487/how-to-retrieve-get-variables-from-rewritten-urls

尝试添加重写规则并让我知道是否有任何查询。

于 2015-09-23T11:08:50.047 回答