Warning: This function has been deprecated. Use wpdb::esc_like() instead.
like_escape() WordPress Function
The like_escape() function is used to escape LIKE wildcard characters in a string for use in a SQL LIKE clause. This function is useful for ensuring that LIKE wildcard characters do not cause unexpected results when used in a SQL query.
like_escape( string $text ) #
Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.
Description
See also
Parameters
- $text
(string)(Required)The text to be escaped.
Return
(string) text, safe for inclusion in LIKE query.
Source
File: wp-includes/deprecated.php
function like_escape($text) { _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.0.0 | Use wpdb::esc_like() |
2.5.0 | Introduced. |