Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Firstly my problem was the %tag% in the permalink, but I resolved it with this patch:
%tag% in permalink not working

So my custom structure now looks like this:

/%category%/%tag%/%postname%/

And the url is like:

/category_name/tag_name/post_name`

However, now I have something else that I can't resolve. When post doesn't have any tag the url becomes:

/category_name//post_name

.. which is undesired.

If post does'nt have tags, i would like the url to be..

/category_name/post_name

and if it does..

/category_name/tag_name/post_name

Anyone have an idea how to solve this?

share|improve this question

1 Answer 1

I don't think there is an easy way to solve this, because /some-category/some-tag/ will be used as an overview page for all posts in category some-category and with tag some-tag. If an URL like /cocktails/bloody-mary/ comes in for a post with the name bloody-mary, category cocktails and no tags, WordPress can't split it up correctly because at that time it does not know that bloody-mary is not a tag, and should thus be a post name.

The best solution is to use a fixed string when there is no tag (untagged, like uncategorized is what I used in my answer to your related question).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.