2

At present I'm using this permalink structure /%category%/%postname%/. There are some existing post type. I want to change permalink for image post type to image/%post_id%/, and don't want to affect other post type and their permalinks.

2 Answers 2

1

This will be done when you register_post_type :

  $args = array(
        'rewrite' => array( 'slug' => 'book' ),
      ); 

    register_post_type( 'book', $args );

IMPORTANT ! Remember to go to wp-admin options > permalink and click SAVE on that page for the changes to take effect.

2
  • I'm using core post type "Image" (theme default). So how can i re-declare it? Please elaborate. I added above code in functions.php and changed 'book' to 'image' & it didn't work.
    – Prateek
    Commented May 6, 2013 at 12:38
  • Great! hope it helped. Have a nice day
    – ThaWolf
    Commented May 6, 2013 at 15:31
0

I would give the Custom Post Type Permalinks plugin a try (it sounds like it will allow you to do exactly what you want).

Alternatively you could probably manually edit your rewrite rules (in .htaccess), however re-saving your permalink settings would probably reset your rules each time.

Hope that helps, have fun!

3
  • but that change only for custom post type, not for default one. How it will work for default post types?
    – Prateek
    Commented May 5, 2013 at 19:07
  • It's better etiquette to reply here with your solution in case someone else runs into the same problem.
    – Jared Cobb
    Commented May 6, 2013 at 14:39
  • i didn't solve this. I just created a new post type named "Image" and called all arguments by using 'support' in argument array. Still there are some problems with it :( that it is calling wp default argument, while as i need theme functions in custom post type. Still finding this answer. Do u know abt it?
    – Prateek
    Commented May 6, 2013 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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