自定义帖子类型固定链接在单页中显示博客/

时间:2015-07-03 04:38:05

标签: wordpress blogs permalinks

我创建了一个自定义帖子类型,它永久链接显示博客/进入单页, 例如:www.example.com/blog/event/wine-tasting /

我需要从单页网址中删除此博客/它应该是这样的, www.example.com/event/wine-tasting /

1 个答案:

答案 0 :(得分:3)

我做了一些研究并想出了这篇文章:

  

注册自定义帖子类型时,您必须指定   重写规则不应该与现有的URL结构一起使用。

     

简而言之,这意味着您在register_post_type中的这一行调用:

     

'rewrite' => array('slug' => 'projects'),应该变成这个:

     

'rewrite' => array('slug' => 'projects','with_front' => false),For   更多信息,请查看codex条目中的重写参数   register_post_type

     

编辑:只需确保在更新代码后刷新   访问设置>重写规则固定链接。否则你就会   仍然看到旧的链接。 - andreiio

如果你被另一个问题here难倒,也可以找到这3个可以帮到你的资源 - 索菲亚:

WordPress.org Topic

TutsPlus

Another Question