bp_esc_like( string $text )
Escape special characters in a SQL LIKE clause.
Description Description
In WordPress 4.0, like_escape() was deprecated, due to incorrect documentation and improper sanitization leading to a history of misuse. To maintain compatibility with versions of WP before 4.0, we duplicate the logic of the replacement, wpdb::esc_like().
See also See also
- wpdb::esc_like(): for more details on proper use.
Parameters Parameters
- $text
-
(Required) The raw text to be escaped.
Return Return
(string) Text in the form of a LIKE phrase. Not SQL safe. Run through wpdb::prepare() before use.
Source Source
File: bp-core/bp-core-functions.php
function bp_esc_like( $text ) { global $wpdb; if ( method_exists( $wpdb, 'esc_like' ) ) { return $wpdb->esc_like( $text ); } else { return addcslashes( $text, '_%\\' ); } }
Changelog Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |