sanitize_text_field
Filter HookDescription
Filters a sanitized text field string.Hook Information
File Location |
wp-includes/formatting.php
View on GitHub
|
Hook Type | Filter |
Line Number | 5585 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$filtered
|
The sanitized string. |
string
|
$str
|
The string prior to being sanitized. |
Usage Examples
Basic Usage
<?php
// Hook into sanitize_text_field
add_filter('sanitize_text_field', 'my_custom_filter', 10, 2);
function my_custom_filter($filtered, $str) {
// Your custom filtering logic here
return $filtered;
}
Source Code Context
wp-includes/formatting.php:5585
- How this hook is used in WordPress core
<?php
5580 * @since 2.9.0
5581 *
5582 * @param string $filtered The sanitized string.
5583 * @param string $str The string prior to being sanitized.
5584 */
5585 return apply_filters( 'sanitize_text_field', $filtered, $str );
5586 }
5587
5588 /**
5589 * Sanitizes a multiline string from user input or from the database.
5590 *
PHP Documentation
<?php
/**
* Filters a sanitized text field string.
*
* @since 2.9.0
*
* @param string $filtered The sanitized string.
* @param string $str The string prior to being sanitized.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/formatting.php
Related Hooks
Related hooks will be displayed here in future updates.