Support » Installing WordPress » %tag% in permalinks doesn’t work

Viewing 4 replies - 1 through 4 (of 4 total)

    you can’t use %tag% in your permalinks but can use it as the category base

    That article seems to indicate that %tag% is an option for permalinks.

    To test this theory out, I MANUALLY typed the permalink with the tag in my browser and it worked perfectly.

    For example:

    My custom structure: /%year%/%category%/%tag%/%postname%
    Sample tag: hockey
    Sample category: sports

    The URL will than look like:

    When I access this in the browser, it works fine.

    HOWEVER, when I click it from the blog, it returns this link:

    This obviously means the %tag% permalink works; it’s just that WordPress isn’t linking to it properly.

    Any help would be much appreciated!

    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);
        if (!empty($post_tag_name))
            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.

    Yes… this is a problem I have discovered as well.

    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. and and instead it will put permalinks in as 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.