sanitize_key
Filter HookDescription
Filters a sanitized key string.Hook Information
File Location |
wp-includes/formatting.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2196 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$sanitized_key
|
Sanitized key. |
string
|
$key
|
The key prior to sanitization. |
Usage Examples
Basic Usage
<?php
// Hook into sanitize_key
add_filter('sanitize_key', 'my_custom_filter', 10, 2);
function my_custom_filter($sanitized_key, $key) {
// Your custom filtering logic here
return $sanitized_key;
}
Source Code Context
wp-includes/formatting.php:2196
- How this hook is used in WordPress core
<?php
2191 * @since 3.0.0
2192 *
2193 * @param string $sanitized_key Sanitized key.
2194 * @param string $key The key prior to sanitization.
2195 */
2196 return apply_filters( 'sanitize_key', $sanitized_key, $key );
2197 }
2198
2199 /**
2200 * Sanitizes a string into a slug, which can be used in URLs or HTML attributes.
2201 *
PHP Documentation
<?php
/**
* Filters a sanitized key string.
*
* @since 3.0.0
*
* @param string $sanitized_key Sanitized key.
* @param string $key The key prior to sanitization.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/formatting.php
Related Hooks
Related hooks will be displayed here in future updates.