I have custom tables in the database i.e.
g_projects with loads of columns. Data is stored in the table using the Wordpress native insert query i.e.
$wpdb->insert, hence they are escaped.
Input: Application's Document
Database: Application\'s Document
The problem is how can I perform search on the escaped columns because they are stored as "Application\'s Document" whereas, I want to be able to search as "Application Document".
My query below returns nothing:
$wpdb->query("SELECT * FROM g_projects WHERE type=\"Application's Document\"");
I am using POSTMAN add-on to call my API which then uses
$wpdb->insert() method to insert new records. Upon further investigation I observed that the slashes were actually added by the
POSTMAN somehow because If I pass data to API using
POSTMAN it stores escaped strings. Whereas, if I use the
$wpdb->insert() directly it will store string without slashes as suggested below by @TheDeadMedic
This is the final edit for those who faced similar problems using POSTMAN. POSTMAN actually escapes string before passing to the
$wpdb->insert() function. Therefore, use
$wpdb->unslash() on the $data before passing to the insert function.