Title: checking variable length in sanitization functions
Last modified: February 9, 2019

---

# checking variable length in sanitization functions

 *  Resolved [Mostafa Shahiri](https://wordpress.org/support/users/mostafadeveloper/)
 * (@mostafadeveloper)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/checking-variable-length-in-sanitization-functions/)
 * Hi
 * WordPress has some functions to sanitize different variables. Do these functions
   control input variable length and then they sanitize the variable? For example,
   Does sanitize_text_field first check variable length, if it’s length is greater
   than a value, then it truncates the variable?

Viewing 1 replies (of 1 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [7 years, 4 months ago](https://wordpress.org/support/topic/checking-variable-length-in-sanitization-functions/#post-11187694)
 * No. You’d need to write a filter to add a check for length
 * [https://developer.wordpress.org/reference/functions/sanitize_text_field/](https://developer.wordpress.org/reference/functions/sanitize_text_field/)

Viewing 1 replies (of 1 total)

The topic ‘checking variable length in sanitization functions’ is closed to new 
replies.

## Tags

 * [function](https://wordpress.org/support/topic-tag/function/)
 * [length](https://wordpress.org/support/topic-tag/length/)
 * [sanitize](https://wordpress.org/support/topic-tag/sanitize/)
 * [variable](https://wordpress.org/support/topic-tag/variable/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/checking-variable-length-in-sanitization-functions/#post-11187694)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
