stopped deprecated warnings about like_escape() function since WP 4.0

This commit is contained in:
claudiosmweb 2014-08-21 14:00:39 -03:00 committed by Ninos Ego
parent 2acfe34d0c
commit c3e7e1e49f
1 changed files with 7 additions and 2 deletions

View File

@ -1684,9 +1684,14 @@ class WC_AJAX {
global $wpdb; global $wpdb;
$term = wc_clean( stripslashes( $_GET['term'] ) ); $term = wc_clean( stripslashes( $_GET['term'] ) );
if ( method_exists( $wpdb, 'esc_like' ) ) {
$term = $wpdb->esc_like( $term );
} else {
$term = like_escape( $term );
}
$query->query_from .= " INNER JOIN {$wpdb->usermeta} AS user_name ON {$wpdb->users}.ID = user_name.user_id AND ( user_name.meta_key = 'first_name' OR user_name.meta_key = 'last_name' ) "; $query->query_from .= " INNER JOIN {$wpdb->usermeta} AS user_name ON {$wpdb->users}.ID = user_name.user_id AND ( user_name.meta_key = 'first_name' OR user_name.meta_key = 'last_name' ) ";
$query->query_where .= $wpdb->prepare( " OR user_name.meta_value LIKE %s ", '%' . like_escape( $term ) . '%' ); $query->query_where .= $wpdb->prepare( " OR user_name.meta_value LIKE %s ", '%' . $term . '%' );
} }
/** /**