like_escape

Formerly used to escape strings before searching the DB.

Description

(string) like_escape( (string) $text ); 

It was poorly documented and never worked as described.

Returns (string)

text, safe for inclusion in LIKE query.

Parameters (1)

0. $text (string)
The text to be escaped.

Usage

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

Defined (1)

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

/wp-includes/deprecated.php  
  1. function like_escape($text) { 
  2. _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); 
  3. return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );