Search code examples
wordpresspermalinkscustom-post-type

How to rewrite URI of custom post type?


The site that I am working on uses the following "pretty" permalink structure:

http://example.com/blog/my-special-post

But for a custom post type my client would like to avoid having a "pretty" slug:

http://example.com/product/142

How can the post ID be used in place of the slug?

I believe that this might be possible using WP_Rewrite, but I do not know where to begin.


Solution

  • I posted the same question on WordPress stack exchange site and received a good solution:

    WordPress StackExchange - How to rewrite URI of custom post type?