Tell us what you are trying to do?
- I have a custom post type called 'Reference'
- The user is able to input a 'Reference' in the front end via a Post Form
- Each 'Reference' title is currently set by the user inputting into a text field (which is actually the 'post_title' field). On my form itself, I just label this field the 'Project ORC Ref'.
- It is required that ALL "Project ORC Ref's" are to be UNIQUE (therefore the post_title of each Reference post also needs to be unique)
- Currently, when a user inputs a Reference into the post form, I have some code (shown below, which is in my functions.php file) which checks if the post_title is unique, and if it's not it throws an error message, it stops the post from saving, and will therefore require the user to change the 'Project ORC Ref' field to something else, and it will only save it this is unique.
** That methodology worked fine when I was only required to get website admin Users to input References (as they could keep a separate list of ORC Ref's and just manually input a unique one each time). However the requirements for this have now changed, as non-company staff users (ie clients of the company itself) are now able to input their own References into their account.
So, what I really need now, is for when this post form loads, is for toolset to be able to generate a unique post title and to put this in as the value into the post_title field (also to make it so that the user is unable to change this field).
So please can you tell me how I could achieve this? I know that of course the actual post_id number will always be unique, so I would have no problem in using this (I would just like possibly to be able to prefix this with 'ORC-' as well).
Thanks so much in advance for your help 🙂
Keith
Is there any documentation that you are following?
I have tried searching the forum but I could not find anything similar to this issue
Is there a similar example that we can see?
No
What is the link to your site?
I can provide links / logins etc if you provide me with a private box to put them in