• 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)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    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. https://www.ads-software.com/extend/plugins/custom-post-permalinks/

    Thread Starter RSimpson

    (@rsimpson)

    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.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    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.

    Thread Starter RSimpson

    (@rsimpson)

    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 ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

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

    Thread Starter RSimpson

    (@rsimpson)

    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?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

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

    Thread Starter RSimpson

    (@rsimpson)

    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 ??

    Thread Starter RSimpson

    (@rsimpson)

    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.