I use this code:

   $search = $this->wpdb->prepare("WHERE (name LIKE %s OR tag LIKE %s)", '%'. $this->wpdb->esc_like($word) .'%', '%'. $this->wpdb->esc_like($word) .'%'); 

and in console i get:

name LIKE '{4b9ad9b602bd32ff99324feebaa1883bb3a3e818f587b35198d4e48093375c78}night{4b9ad9b602bd32ff99324feebaa1883bb3a3e818f587b35198d4e48093375c78}' OR tag LIKE '{4b9ad9b602bd32ff99324feebaa1883bb3a3e818f587b35198d4e48093375c78}night{4b9ad9b602bd32ff99324feebaa1883bb3a3e818f587b35198d4e48093375c78}'

how i can remove this strange string?

1 Answer 1


That is a placeholder escape string generated by wpdb::placeholder_escape() which is used by wpdb::add_placeholder_escape() and which is called by wpdb::prepare().

So it is safe to keep those escape strings, but there is a wpdb method for removing them: wpdb::remove_placeholder_escape():

// In your case, you'd use $this->wpdb in place of $wpdb.
$query = $wpdb->add_placeholder_escape( 'LIKE %night%' );
$query2 = $wpdb->remove_placeholder_escape( $query );
var_dump( $query, $query2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.