I want permalink to use post tags/postid? How? (5 posts)

  1. webcabbie
    Posted 3 years ago #

    I want permalink to use post tags/postid? How? I want my permalink structure to be made up of all the tags on the post plus a post id. Is this possible?

  2. bcworkz
    Posted 3 years ago #

    If you provide the post's title slug as the permalink endpoint, you can add any random tags before that and the same post will be returned, whether the tags relate to the post or not. This only works if the tags provided are not recognized as anything the parser should use as query variables.

    For example, all the following permalinks return the same post, even though the post is tagged with 'blue' and 'oval' only and published in 2013:

    Because the parser can recognize years, the following will not work:

  3. webcabbie
    Posted 3 years ago #

    So I think maybe I did not explain it right. I have a wordpress blog with many posts already on it. all of these posts already have tags on them. Instead of using the postname for the permalink I would prefer that the permalink is made up of the tags that the post has and then a post id.

    Its my belief that this was greatly benefit seo as it would give keyword rich unique urls.

    Is there a way to do what I am asking?

  4. bcworkz
    Posted 3 years ago #

    No you explained it right, I went off on a tangent to illustrate how you could do something similar without changing anything. One way to use the actual ID without changing anything is to provide an arbitrary permalink of tags and provide the ID as an URL parameter, like so:

    where 'red' and 'square' are any tags you like, just as the previous examples illustrated. 123 is the actual post ID.

    If you want the ID as part of the URL and not as a parameter, something like this:

    you could perhaps use the Rewrite API to define the post ID as a rewrite endpoint and you should get behavior similar to what I illustrated for post title slugs, except now post IDs would work as well. I think you may need to insert an identifying element so the rewrite engine knows you're providing an ID, maybe a 'p'? Like so:

    I've not used the rewrite endpoint feature, so I'm not too sure how it really works. I'm pretty sure there's a way to make the Rewrite API work for you though, I'm just not able to provide functional code.

  5. webcabbie
    Posted 2 years ago #

    This is the longest no/i dont know I have ever read.

    Again.. Is there a way to use the post tags/title as permalink structure?

Topic Closed

This topic has been closed to new replies.

About this Topic