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

I’ve been searching a way to have kind of “two” slugs for a custom post, let me give an example:

www.mywebsite.com/articles/ or www.mywebsite.com/articles/page/2/ for the archive
www.mywebsite.com/article/%post-name%/ for the single custom post

1 Answer
1

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...
]

Leave a Comment