首页 > 解决方案 > 在 Wordpress URL 重写规则中连接 $matches

问题描述

我正在尝试在我的查询变量中使用 2 个正则表达式的结果来重写特定的 URL:

add_rewrite_rule('edition/([^/]*)/([^/]*)', 'index.php?pagename=$matches[2]-$matches[1]', 'top');

它不起作用,当:

add_rewrite_rule('edition/([^/]*)/([^/]*)', 'index.php?pagename=videos-$matches[1]', 'top');

完美的作品,所以似乎我没有正确连接这两个值,但我找不到正确的方法。有人有线索吗?

标签: regexwordpressurl-rewriting

解决方案


推荐阅读