admin管理员组文章数量:1130349
I've been searching a way to have kind of "two" slugs for a custom post, let me give an example:
www.mywebsite/articles/ or www.mywebsite/articles/page/2/ for the archive
www.mywebsite/article/%post-name%/ for the single custom post
I've been searching a way to have kind of "two" slugs for a custom post, let me give an example:
www.mywebsite/articles/ or www.mywebsite/articles/page/2/ for the archive
www.mywebsite/article/%post-name%/ for the single custom post
Share
Improve this question
asked Nov 1, 2018 at 2:52
Rodrigo ButzkeRodrigo Butzke
17513 bronze badges
1 Answer
Reset to default 11Both of these are controlled by the arguments passed to register_post_type, specifically, the rewrite and has_archive arguments:
$args = [
'rewrite' => ['slug' => 'article'],
'has_archive' => 'articles',
// the rest of your arguments...
]
I've been searching a way to have kind of "two" slugs for a custom post, let me give an example:
www.mywebsite/articles/ or www.mywebsite/articles/page/2/ for the archive
www.mywebsite/article/%post-name%/ for the single custom post
I've been searching a way to have kind of "two" slugs for a custom post, let me give an example:
www.mywebsite/articles/ or www.mywebsite/articles/page/2/ for the archive
www.mywebsite/article/%post-name%/ for the single custom post
Share
Improve this question
asked Nov 1, 2018 at 2:52
Rodrigo ButzkeRodrigo Butzke
17513 bronze badges
1 Answer
Reset to default 11Both of these are controlled by the arguments passed to register_post_type, specifically, the rewrite and has_archive arguments:
$args = [
'rewrite' => ['slug' => 'article'],
'has_archive' => 'articles',
// the rest of your arguments...
]
本文标签: Custom post type with slug for plural (archive) and for single
版权声明:本文标题:Custom post type with slug for plural (archive) and for single 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749215669a2334118.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论