I have a website that I am working on. I created an html form and put in some code that will take the form data and create a new wordpress post. It will post the information to a specific category. All is working.

Now I want to know what I can do to protect the data being entered? Should I use php and write pregmatch statements for every input? I have 7 different inputs on my form. I was thinking that wordpress would already have some functions that I could use to validate the data to make sure someone isn't trying any bad things with my form. The users who will fill out this form will not be registered or logged in.

1 Answer 1


Take a look at WordPress codex Data Validation entry, it covers most of the validation functions that come built-in with WordPress which you can use to validate your form submission.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.