I have a custom post type named Reportage, added in functions.php:
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'reportage',
array(
'labels' => array(
'name' => __( 'Reportage' ),
'singular_name' => __( 'Reportage' )
),
'public' => true,
'taxonomies' => array('category'),
'query_var' => true
)
);
register_taxonomy_for_object_type('category', 'reportage');
}
Now I want to use this custom url structure: “/%posttype%/%category%/%postname%”, but the permalinks gets generated as (and redirected to when visited) “/%posttype%/%postname%”. How do I change the permalinks structure to “/%posttype%/%category%/%postname%”?
I need to have “/%posttype%” to route to a regular page with the same name as the posttype (Reportage), this works fine now.
I also need to “/%posttype%/%category%” to route to something like the category.php file.
How can I make this work?
My plugin Custom Post Permalinks does this.
http://wordpress.org/extend/plugins/custom-post-permalinks