Get a permalink structure of /%posttype%/tegory%/%postname%

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%”?

Read More

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?

Related posts

Leave a Reply

1 comment