WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/sanitize title for query

Description

Sanitizes a title with the 'query' context. Used for querying the database for a value from URL. Shorthand for sanitize_title($title, "", "query") (See sanitize_title()).

Usage

<?php sanitize_title_for_query( $title ); ?>

Parameters

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

Return Values

(string) 
Sanitized string.

Examples

Notes

Since sanitize_title_for_query() calls sanitize_title(), the sanitize_title filter is applied with a context of 'query'.

Change Log

Since: 1.0.0

Source File

sanitize_title_for_query() is located in /wp-includes/formatting.php.

Related

Functions

sanitize_title_for_query() 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:

Filters