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

I registered custom post type by register_post_type('new_post',$args); So new post url looks like `http://myweb.com/new_post/post_name

Can I change _later_ the part of url from new_post to something else?

share|improve this question
i know the answer to this question but with a 29% accept rate it would be pointless to help you Radek, go back and accept some of your older Question then i will answer your question. – Xavier Apr 9 '11 at 14:24
up vote 2 down vote accepted

It would help if you listed your $args array, but, the portion you are looking for is under 'rewrite'. Here's the way I like to build an $args array for registering a post type:

// set up the labels
    $labels = array(
        'name' => _x('Archived Jobs', 'post type general name'),
        'singular_name' => _x('Archived Job', 'post type singular name'),
        'add_new' => __('Add New'),
        'add_new_item' => __('Add New Job'),
        'edit_item' => __('Edit Job'),
        'new_item' => __('New Job'),
        'view_item' => __('View Job'),
        'search_items' => __('Search Jobs'),
        'not_found' =>  __('No Jobs found'),
        'not_found_in_trash' => __('No Jobs found in Trash'), 
        'parent_item_colon' => '',
        'menu_name' => 'Archives'
//set up the rewrite rules
    $rewrite = array(
        'slug' => 'archives'
//build the arguement array
    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true, 
        'show_in_menu' => true, 
        'query_var' => 'archives',
        'rewrite' => $rewrite,
        'capability_type' => 'post',
        'has_archive' => true, 
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor','author','comments')

The portion of this you are looking for is the $rewrite part, change the slug to whatever you want (url friendly of course, no weird characters or spaces). You may even wish to put slashes in there. In my example, a URL reads: www.website.com/archives/post_name/

share|improve this answer
Don't get to visit the permalinks page to(else the post type rewrite rules aren't updated). – t31os Apr 9 '11 at 16:30
@t31os: Dont forget to visit the page, I assume? – Jan Fabry Apr 9 '11 at 21:07
@Jan - Indeed... not spotted in time for a ninja edit though.. :( – t31os Apr 10 '11 at 9:55
Remember that when you change the URL structure, the existing posts will use the new URLs too, and the old URLs will no longer work. If this is a problem you should add redirects from the old to the new URLs. – Jan Fabry Apr 10 '11 at 10:42
@Drew, @t31os, @Jan what confuses me is if I can change the url structure after I create custom post type. If yes, how? And what I have do after that. – Radek Apr 10 '11 at 11:17

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.