sanitize_title
Filter HookDescription
Filters a sanitized title string.Hook Information
File Location |
wp-includes/formatting.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2233 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$title
|
Sanitized title. |
string
|
$raw_title
|
The title prior to sanitization. |
string
|
$context
|
The context for which the title is being sanitized. |
Usage Examples
Basic Usage
<?php
// Hook into sanitize_title
add_filter('sanitize_title', 'my_custom_filter', 10, 3);
function my_custom_filter($title, $raw_title, $context) {
// Your custom filtering logic here
return $title;
}
Source Code Context
wp-includes/formatting.php:2233
- How this hook is used in WordPress core
<?php
2228 *
2229 * @param string $title Sanitized title.
2230 * @param string $raw_title The title prior to sanitization.
2231 * @param string $context The context for which the title is being sanitized.
2232 */
2233 $title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
2234
2235 if ( '' === $title || false === $title ) {
2236 $title = $fallback_title;
2237 }
2238
PHP Documentation
<?php
/**
* Filters a sanitized title string.
*
* @since 1.2.0
*
* @param string $title Sanitized title.
* @param string $raw_title The title prior to sanitization.
* @param string $context The context for which the title is being sanitized.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/formatting.php
Related Hooks
Related hooks will be displayed here in future updates.