2017-10-09 105 views
-1

如何从网址中删除slug。Wordpress从网址中删除Slug

我可以做出这个;

www.example.com/tour/boat

www.example.com/boat

我想不出这个工作;

www.example.com/en/tour/boat-to是

www.example.com/en/boat-to是

通常所有方法不工作多郎现场。

+1

欢迎来到SO,请展示您的代码的一些示例,即您已经尝试过的内容。 – JustBaron

回答

0

当您注册自定义帖子类型时,必须指定重写规则不应与现有URL结构一起作为前缀。

总之,这意味着这条线在你的register_post_type电话:

'rewrite' => array('slug' => 'tour'), 

应该变成这样:

'rewrite' => array('slug' => 'tour','with_front' => false), 

欲了解更多信息,请从食品项的重写参数register_post_type

只需确保更新代码后,通过访问设置>固定链接刷新重写规则。否则,你仍然会看到旧的链接。

+0

我尝试,但它不工作谢谢。 –

+0

在这种情况下,请尝试使用这些插件:https://wordpress.org/plugins/custom-permalinks/和https://fr.wordpress.org/plugins/permalinks-customizer/ – Paul