esc_like()WP-CLI 1.0

First half of escaping for LIKE special characters % and _ before preparing for MySQL.

Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security.

Copied from core "wp-includes/wp-db.php". Avoids dependency on WP 4.4 wpdb.

Хуков нет.


Строку. Text in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare() or real_escape next.


esc_like( $text );
$text(строка) (обязательный)
The raw text to be escaped. The input typed by the user should have no extra or deleted slashes.

Код esc_like() WP-CLI 2.7.0-alpha

function esc_like( $text ) {
	return addcslashes( $text, '_%\\' );