WordPress.org

Ready to get started?Download WordPress

Forums

universal permalink structure across post types (not pages) (10 posts)

  1. Robert Simpson
    Member
    Posted 3 years ago #

    Hi folks,

    I'm looking for a way to have all posts from all non-hierarchical post types use the same simple permalink structure.

    The structure I'd like to use is this:

    /%year%/%postname%-%post_id%/

    As you can see this removes the need for any post type names or taxonomy names and there's no chance of slugs clashing thanks to the post id at the end.

    Is this possible?

    Cheers,
    Robert

  2. 5 bumps deleted. Please don't do that.

    You're talking Custom Post Types, I presume?

    I think you're still going to run into a postname conflict, in that if you make two posts of the same name, the second will get -2 tacked on.

    ETA - This plugin, which is no longer supported, may be what you need. http://wordpress.org/extend/plugins/custom-post-permalinks/

  3. Robert Simpson
    Member
    Posted 3 years ago #

    I think you're still going to run into a postname conflict, in that if you make two posts of the same name, the second will get -2 tacked on.

    This is why I've added -%post_id% to the end in order to avoid conflicts.

  4. Yeah, but that's now how WP sees it (I THINK! I could be wrong!)

    try it out. Go make two posts with the slug 'test' and I'm pretty sure it'll change it to 'test-2' on one of 'em.

  5. Robert Simpson
    Member
    Posted 3 years ago #

    I tried it out on another site I'm working on, it happily recognised the post ID was on the end of the slug and didn't add -2 to it :)

  6. Hey cool! That was killing me on another site. Then you should be good to go :)

  7. Robert Simpson
    Member
    Posted 3 years ago #

    Do you think it's wise to use a plugin which could break at the next update? You're not aware of any way I can achieve this within functions.php in my theme?

  8. You could fork the plugin. I don't know that the plugin will break (the author's really a smart fellow, even if he did stop supporting it, it's well written).

  9. Robert Simpson
    Member
    Posted 3 years ago #

    I wish I was enough of a PHP guru to fork it, plus I'm sure it's something which will end up in the core eventually. Unfortunately it's something which would be really handy right now.

    I'll give the plugin a try and report back on how I get on with it.

    Thanks for your help :)

  10. Robert Simpson
    Member
    Posted 2 years ago #

    Damnit, I went to download the plugin and it's gone :(

Topic Closed

This topic has been closed to new replies.

About this Topic