Skip Navigation

[Resolved] Add post ID to custom post slug via cred form to prevent duplicate posts

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by Rita 5 years, 11 months ago.

Author
Posts
#1178165

Hi there

I am having a real problem with duplicate slugs... Members seem to be able to create posts with the same title and slug via cred form... I would love your advice on the best way to tackle this issue... From all that I have read on the web and in this forum the best solution is to add the post ID to the post slug but NOT to the title. Is that right? So for example it would be something like this (12345 being the post_id):

TITLE: This is my story
SLUG: mywebsite.com/story/12345/this-is-my-story

I have already added a unique id to the title AND slug but site members are complaining they don't like it especially when their post is shared on social networks... Example:

TITLE: This is my story #12345
SLUG: mywebsite.com/story/this-is-my-story-12345

The site is very established and I see that I should have anticipated this when I first built it but back then I was a complete beginner... I wish I had known...

I don't want to change the slugs of the existing posts (there are 1000's) as it would take weeks to set up redirections for each post so I just need to make this change for new posts being created from now on.

Also, perhaps I should mention, members need to be able to edit their title AND slug. I have a php snippet in functions.php to allow this.

Is there a way to do this or do you recommend a better way to ensure every post slug is unique?

Regards

Rita

#1178185

My issue is resolved now. Thank you!