I’m actually having this issue, too. Since it works otherwise fine EXCEPT for permalink generation, I figured it’s got to be something wrong in the permalink generation, and this is the (hacky) thing I ended up doing (this is WP 3.0):
Go to /wp-includes/link-template.php
Go to the function “get_permalink”. in the array $rewritecode, add another entry of ‘%tag%’ at the very end. You will also have to add a corresponding entry at the end of $rewritereplace. Before that array is declared, I did:
$post_tag_name = get_the_tags($post->ID);
foreach($post_tag_name as $tag)
$post_tag_name = $tag->slug;
And then at the end of $rewritereplace, I added $post_tag_name.
I presume you can do the same thing for custom taxonomies.
This is pretty hacky, but it works. Ideally, this should be a plugin, but I don’t care enough right now to do it right.
I have to use tags because WordPress refuses to use anything but nested categories for permalinks. No way to just use your primary category for permalinks like many blogs/newspapers do, e.g. times.co/hockey and times.co/football and instead it will put permalinks in as times.co/hockey/blackhawks/postname etc. It just gets far too long and there is no ability to edit slugs so you can have a long visual name and short slug. Very, very bad system in 3.0. Dumbing down the slugs is a poor idea and an error message after validation would be fine like “the slug you are using is being used for another category.”
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘%tag% in permalinks doesn’t work’ is closed to new replies.