[wp-hackers] Legacy URL WP_Rewrite

Greg Waugh wphackers at em.stonedrop.com
Fri Nov 19 15:24:16 UTC 2010


I am building out a fairly large site in WP 3.0.1 and would like to import all of the legacy content from former CMS and preserve the old link structure.  It's fine to do it as a custom post type, but I am having a little bit of trouble setting up a WP_Rewrite and/or a permalink structure to match it.

The current linking structure is:

http://www.site.com/home/articles/article/100/12345/

Where the 100 is the post's category, and the 12345 is the post's ID.  I am totally good with making the 12345 the post's slug when we bring it into Wordpress, but I am having trouble with the fact that the category ID can vary -- always numeric, but could be 101, 102, 103, etc.

Essentially, that ID is redundent and not necessary, so I really just need to ignore it, but I am having trouble coming up with a WP_Rewrite rule and/or custom post type permalink structure code that will accomodate it. Since we aren't going to be adding posts to it, the default permalink for this post type can be /home/articles/article/100/(slug).

Any help or formulas would be awesome!


More information about the wp-hackers mailing list