Use Custom Unique ID Field for URL when Post Title is Not Unique
-
Hi everyone,
I have a website with a Toolset custom post type called Meetings. The public can use the post form to add their meetings, many of which will have the same name like “Tuesday Meeting” or “Sunday Mornings”. They can call their meeting whatever they want, but the point is there will be duplicate names.
Of course, WordPress doesn’t like this, with its default post title URL structure that no man dare change, so I need to have a custom “Meeting ID” field be the one WordPress uses for the URL, as in website.com/meeting/12345678, not website.com/meeting/tuesday-meeting. The Meeting ID field will be unique. The post title will not.
I have tried creating a custom field for the meeting name, and just using the post title field for the ID, but the problem is, the Meeting ID is assigned by me, after the meeting is submitted. WordPress hates this too, so it assigns some long random name, and when I go to change it to the ID, it adds a -2 after it, no matter what I do.
Why is a platform as sophisticated as WordPress not equipped to take into account that not every post name will be unique in a website? Especially a website that accepts public user post submissions? The rest of my site is fine using the post names, except for this custom post type, so I do not want to change the entire permalink structure of my site to some random post ID.
How can I make my site use the custom field Meeting ID in the URL and NOT the post title?
Thanks,
Beth Shaffer
- The topic ‘Use Custom Unique ID Field for URL when Post Title is Not Unique’ is closed to new replies.