Custom permalink structure for custom post type

I´m using the following code to create a new post type:

/* Create custom post type: "Tilbud" */
register_post_type('tilbud', array(
'label' => __('Tilbud'),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => '???'),
'query_var' => false,
'taxonomies' => array('post_tag','category'),
'supports' => array('title'),
'register_meta_box_cb' => 'add_tilbud_metaboxes',
));

I would like the premalink of these custom posts to contain the custom post type name followed by the post category:

Read More

…/custom-post-type-name/post-category/post-title/

I´m aware that I use the rewrite argument to add a slug, but I don´t know what to write in order to insert the post type name and category name dynamically.

Any ideas?

Thanks!

Related posts

Leave a Reply

2 comments

  1. Just FYI the plugin mentioned above is awesome. Not only do you get permalinks for custom post types, but it supports custom taxonomy too, so something like this is legit:

    /games/%game_category%/%game%
    

    Results in:

    /games/racing/need-for-speed/
    

    Good job!

    (couldn’t post this as a comment for some reason, sorry)