Codex

Function Reference/sanitize title with dashes

Contents

Description

Sanitizes title, replacing whitespace with dashes.

Limits the output to alphanumeric characters, underscore (_) and dash (-). Whitespace becomes a dash.

Note that it does not replace special accented characters (see plugins such as [1] to fix that).

Usage

<?php sanitize_title_with_dashes$title ?>

Parameters

$title
(string) (required) The title to be sanitized.
Default: None

Return Values

(string) 
The sanitized title.

Examples

Default usage

<?php
echo sanitize_title_with_dashes("I'm in LOVE with WordPress!!!1");
// this will print: im-in-love-with-wordpress1
?>

Notes

Change Log

Since: 1.2.0

Source File

sanitize_title_with_dashes() is located in wp-includes/formatting.php#L842.

Related Functions

sanitize_title_with_dashes() is in a class of functions that help you sanitize potentially unsafe data which allow you to pass an arbitrary variable and receive the clean version based on data type. Others include:

Related

See also index of Function Reference and index of Template Tags.