Khalifa,
I would recommend you to following the sanitization and escaping to validate and secure your content.
https://codex.ww.wp.xz.cn/Validating_Sanitizing_and_Escaping_User_Data
Hi,
Thanks. I’ve already read that article and although it is very important it is not what I was looking for.
I’m trying to enforce a certain logic before the post is saved, for example let’s say that I’m using WordPress to keep track of my animals in a small zoo. I have a custom post type called “animal” that contains a list of custom fields assigned to it like name, id, herbivorous_food, carnivorous_food. This custom post type also has custom taxonomy assigned to it called “prey_type” and contains three possible values like herbivorous, carnivorous and omnivorous.
Now, for example, if I’m currently creating a post for a fox, I’ll write fruits and seeds in the herbivorous_food and mice and rats under carnivorous_food and I’ll select omnivorous in the prey_type taxonomy.
What I need is a way to verify that if both fields (herbivorous_food and carnivorous_food) contain value the user will get an alert when he/she tries to save the post unless the only taxonomy that is selected is omnivorous, and if only carnivorous_food contains value than the user will get an alert when he/she tries to save the post unless the only taxonomy that is selected is carnivorous and so on.
Is that possible? If so – how?