sanitize_title_for_query

Sanitizes a title with the 'query' context.

Description

(string) sanitize_title_for_query( (string) $title ); 

Used for querying the database for a value from URL.

Returns (string)

The sanitized string.

Parameters (1)

0. $title (string)
The string to be sanitized.

Usage

  1. if ( !function_exists( 'sanitize_title_for_query' ) ) { 
  2. require_once ABSPATH . WPINC . '/formatting.php'; 
  3.  
  4. // The string to be sanitized. 
  5. $title = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = sanitize_title_for_query($title); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/formatting.php  
  1. function sanitize_title_for_query( $title ) { 
  2. return sanitize_title( $title, '', 'query' );