sanitize_title_for_query() WordPress Function

The sanitize_title_for_query() function is a WordPress core function that is used to sanitize a string for use in a SQL query. The function is located in wp-includes/formatting.php.

sanitize_title_for_query( string $title ) #

Sanitizes a title with the ‘query’ context.


Description

Used for querying the database for a value from URL.


Top ↑

Parameters

$title

(string)(Required)The string to be sanitized.


Top ↑

Return

(string) The sanitized string.


Top ↑

More Information

Usage:
sanitize_title_for_query( $title );
Notes:

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


Top ↑

Source

File: wp-includes/formatting.php

function sanitize_title_for_query( $title ) {
	return sanitize_title( $title, '', 'query' );
}


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More