Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using Wordpress as CMS and have a checkout page where info is inserted into the db using $wpdb->insert. I have 2 questions:

  1. Is 'sql injection' already a part of that function or do I need to add my own code?
  2. Are there wordpress form input validation functions that I can use on my custom form?
share|improve this question

2 Answers 2

up vote 3 down vote accepted

Is 'sql injection' already a part of that function or do I need to add my own code?

When inserting input to the database you should use prepare method of WPDB class which supports both a sprintf() - like and vsprintf() -like syntax. read more at the codex

Are there wordpress form input validation functions that I can use on my custom form?

Yes there are many and they are covered in Data Validation codex entry like toscho pointed out.

share|improve this answer

The Codex has a really good page about this topic: Data Validation. There isn’t much to add. :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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