In WordPress I have a custom post type called 'samples'.
These posts have several meta keys, one of which is called 'sample_number' which has a meta_value (it's always a number).
I have created a front-end form where users can enter in a sample number before submitting the form, but I need to check if the database already has a meta_key called 'sample_number' with a meta_value the same as the one they just entered.
For example: if the user entered 100 into the sample number field and submitted the form, I need to check if there is any meta_key called 'sample_number' that has a meta_value of 100 (so I can display a warning message or something).
The form is simply posting to a submit.php file where I am creating a new post and post meta, so I will just add the duplication check in that.
Aucun commentaire:
Enregistrer un commentaire