[wp-testers] custom post type permalinks

Otto otto at ottodestruct.com
Wed May 19 13:50:58 UTC 2010


On Wed, May 19, 2010 at 5:10 AM, Frank Bueltge <frank at bueltge.de> wrote:
> My problem is only simpel, i thnik ;)
> I had add a new post_type, see mail below. I have a admin-area for this,
> automaticly from WP - great. When i use the link to "View" post, then works
> this great without active permalinsk, example-url:
> http://localhost/wpbeta/?iphone=custom-post-type-test
>
> the same works not with active permalinks (structure:
> /%post_id%/%category%/%postname%/), also example-url:
> http://localhost/wpbeta/iphone/custom-post-type-test/
>
> Why it is not possible to use the default-url?

Because your custom post_type is not a "post". That "default URL" is
not "default" at all. It's the URL for single "posts" only.

On a deeper level, it's not possible to use this structure because of
how the rewrite system and the query work. The rewrite system needs to
see the URL you're requesting and to determine two main things: the
post_type and the post name. If both "post" and your "custom"
post_types have the same URL structure, then there is no way for it to
determine the post_type.

Bottom line: Custom Post Types CANNOT use the same custom permalink
string as posts do for their URLs. They MUST have some form of text
prefix that distinguishes them in the URL.

-Otto


More information about the wp-testers mailing list