Title: Does wp_insert_post sanitize/validate input?
Last modified: August 19, 2016

---

# Does wp_insert_post sanitize/validate input?

 *  [nickbudden](https://wordpress.org/support/users/nickbudden/)
 * (@nickbudden)
 * [15 years ago](https://wordpress.org/support/topic/does-wp_insert_post-sanitizevalidate-input/)
 * Hello everyone, thanks in advance for any help.
 * I was just wondering if data thrown into the database with `wp_insert_post()`
   and `add_post_meta` was automatically validated/sanitized by WordPress.
 * I ask because I have been trying to write some sanitation/validation functions
   before putting my data into each function, but came across the following today:
 * > $wpdb->insert( $table, (array) $data )
   >  $data should be unescaped (the function
   > will escape them for you). Keys are columns, Values are values.
 * To me it seems to imply that WordPress automatically validates/sanitizes data
   before putting it into the database, however I don’t really understand what it
   says all that well…
 * Thank you again

The topic ‘Does wp_insert_post sanitize/validate input?’ is closed to new replies.

## Tags

 * [add_post_meta](https://wordpress.org/support/topic-tag/add_post_meta/)
 * [sanitization](https://wordpress.org/support/topic-tag/sanitization/)
 * [validation](https://wordpress.org/support/topic-tag/validation/)

 * 0 replies
 * 1 participant
 * Last reply from: [nickbudden](https://wordpress.org/support/users/nickbudden/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/does-wp_insert_post-sanitizevalidate-input/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
