[wp-hackers] Unique permalinks vs. unique post slugs

Otto otto at ottodestruct.com
Tue Dec 16 16:14:38 GMT 2008


On Tue, Dec 16, 2008 at 9:06 AM, Shashi <connect2shashi at gmail.com> wrote:
> You can add the post to two categories...
> the struct will then be:
>
> http://example.com/cat-base/cat-slug/post-slug.html
> http://example.com/cat-base/cat-slug2/post-slug.html
>
> right??
>
> you can hack the rewrite to allow you to have it like this:
> http://example.com/cat-slug/post-slug.html

You'd have to hack a lot more than the rewrite. The query only
operates on the most specific piece found, I think.

So if you give it both a category and a post slug, it then knows a)
you're pulling a single post (so it uses the single post template) and
b) the post to pull has post-slug X. The category is not used, at all.

This is why if you have a permalink string of %category%/%postname%,
then you can give it ANY category in the URL and still get the same
post back. The category is less specific than the postname, so it's
assuming you want the single post.

Changing this would not be trivial.

-Otto


More information about the wp-hackers mailing list