WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to change the permalink of a custom posttype?

I have a custom post type called "events", I have made a page called archive-event.php and this is reached by /event.php

is it possible to change this into something else? Like /foo.php?

share|improve this question
It's impossible to understand what you are asking about. Please clarify. – Max Yudin Feb 8 '13 at 19:39
@MaxYudin - I have created a custom post type called event and have created a page called archive-event to access all posts under "event". To access this page I go to */event but now I want to change this to */foo. – Philip Feb 11 '13 at 10:23
Edit the archive page through the admin panel and change the slug of the archive page to foo and you are good to go. – Rohit Pande Feb 11 '13 at 10:39

When you register your post type you can set the archive page slug to anything you want via the rewrite or has_archive arguments.

If you want single events to have the same slug as the archive, you can set both via:

'rewrite' => array( 'slug' => 'foo' )

Or if you want the archive to have a different slug, set that separately via has_archive:

'has_archive' => 'foo'
share|improve this answer
this doesnt work for me? register_post_type('event', array( 'labels' => array( 'name' => __('Händelser'), 'singular_name' => __('Händelse') ), 'public' => true, 'has_archive' => 'foo', 'supports' => array('title', 'editor', 'custom-fields', 'page-attributes') ) ); – Philip Feb 12 '13 at 9:16
Your code works for me in Twenty Eleven theme, make sure you visit your Settings > Permalinks page after adding the post type to flush the rewrite rules. Single events are available at domain.com/event/post-name/ and the archive is available at domain.com/foo/. – Milo Feb 12 '13 at 15:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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