Custom post type with slug for plural (archive) and for single

admin2025-06-06  1

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
Add a comment  | 

1 Answer 1

Reset to default 11

Both 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...
]
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749215695a317332.html

最新回复(0)