WPDev.one
Core Function
View Source on Trac ↗

sanitize_title()

sanitize_title( mixed $title, mixed $fallback_title = '', mixed $context = 'save' )

Sanitizes a string into a slug, which can be used in URLs or HTML attributes.

Parameters 2 required

Name / Type Description
$title
string

The string to be sanitized.

Required
$fallback_title
string

Optional. A title to use if $title is empty. Default empty.

string

$context Optional. The operation for which the string is sanitized. When set to 'save', the string runs through remove_accents(). Default 'save'.

Required

Return Value

(string)
The sanitized string.

Function Information

Since Version
1.0.0
Source File
wp-includes/formatting.php
Advertisement