WP_CLI\Utils\esc_like() Edit

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

Usage Usage

WP_CLI\Utils\esc_like( $text )
$text (string) The raw text to be escaped. The input typed by the user should have no
@return (string) in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()

Top ↑

Notes Notes

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.
extra or deleted slashes.
or real_escape next.

Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.

Top ↑