我正在做一个项目,涉及过滤前端的一些海关帖子。我设法创建了包含自定义字段的永久链接,但似乎重写规则匹配了一些不需要的页面,使它们无法在前端显示。
我用于重写的代码:
$wp_rewrite->add_rewrite_tag(\'%competition%\', \'([^/]+)\', \'competition=\');
$wp_rewrite->add_rewrite_tag(\'%prize_category%\', \'([^/]+)\', \'prize_category=\');
$wp_rewrite->add_permastruct(\'competition\', \'/au/%prize_category%/%competition%/\', false);
问题如下。它执行此url应执行的操作:http://example.com/au/win-a-holiday/win-a-long-weekend-at-the-rees-hotel-queenstown/
但它也符合这一点:
http://example.com/au/win-a-holiday/
%competition%
未来mandatory? 因此,该规则仅适用于以下URL:http://example.com/au/param1/param2
不适用于domain.com/au/param1/
?
谢谢,乔治