There is a few Q/A about custom post URL rewrite but I haven't found any simple answer to what I'm trying to achieve.

My CTP is "event" and I have the current page structure that I want to preserve:

  • siteurl.com/agenda
  • siteurl.com/event/event-slug

Right now in my theme I use two files single-event.php and page-agenda.php. The latter is the archive page, because I want my archive post slug to be siteurl.com/agenda and not siteurl.com/event so I've created an additional page on my backend.

It's working like that but I'd like to know if there is a more elegant solution to only rewrite my CPT archive page URL while using the proper archive-event.php template?

1 Answer 1


You can have a separate slug for the post type archive by setting the slug as the value for the has_archive argument, instead of just true:

        'has_archive' => 'agenda',
        // etc.

Now you can use single-event.php and archive-event.php for the single and archive views, but the URL for the archive will be siteurl.com/agenda.

  • Perfect, it's that simple! Thank you Jacob Commented Apr 16, 2020 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.