[wp-hackers] add_post_meta won't save unescaped data. Why?

Baki Goxhaj banago at gmail.com
Tue Jan 25 18:03:42 UTC 2011

Hi Hackers,

So, I was trying to insert some meta data to a post inserted by
wp_insert_post. It would not save the metadata and I found this solution:

Basically, the unenscaped data will be not saved.

*Doesn't: *add_post_meta($post_id, 'json-data', $json_string);

*Works: *add_post_meta($post_id, 'json-data', $wpdb->escape($json_string));

Lea and I have the following questions:* Is this a bug or a feature?

Baki Goxhaj
www.wplancer.com | www.banago.info | proverbhunter.com

More information about the wp-hackers mailing list