On this page
like_escape( string $text ): string
This function has been deprecated. Use wpdb::esc_like() instead.
Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.
Description
See also
Parameters
$textstring Required-
The text to be escaped.
Return
string text, safe for inclusion in LIKE query.
Source
File: wp-includes/deprecated.php. View all references
function like_escape($text) {
_deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' );
return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );
}
Related
Uses
| Uses | Description |
|---|---|
| _deprecated_function() wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
Used By
| Used By | Description |
|---|---|
| WP_User_Search::prepare_query() wp-admin/includes/deprecated.php | Prepares the user search query (legacy). |
Changelog
| Version | Description |
|---|---|
| 4.0.0 | Use wpdb::esc_like() |
| 2.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/like_escape