WordPress.org

Support

Support » How-To and Troubleshooting » universal permalink structure across post types (not pages)

universal permalink structure across post types (not pages)

  • 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

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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/

    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.

    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.

    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 🙂

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

    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?

    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).

    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 🙂

    Damnit, I went to download the plugin and it’s gone 🙁

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘universal permalink structure across post types (not pages)’ is closed to new replies.
Skip to toolbar