2

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?

1 Answer 1

1

My plugin Custom Post Permalinks does this.

http://wordpress.org/extend/plugins/custom-post-permalinks

3
  • Works like a charm!
    – tirithen
    Feb 17, 2011 at 10:35
  • I am not able to go to this link. is this plugin deleted from wordpress or replaced with different name? please send me a link
    – Arpita
    Aug 31, 2011 at 2:13
  • 2
    The plugin isn't supported by the original author anymore due to being misused and causing headaches for those not careful with it. Aug 31, 2011 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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