• I have a JSON encoded string $json_string which needs to be stored into the post meta data.

    Doing the following damages the JSON encoded data:

    add_post_meta($post_id, 'json-data', $json_string);

    After searching the Internet I found that somebody else had a similar issue, and it looks as though the following addresses the issue:

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

    3 Questions:

    #1) Is this a fault with WordPress?

    #2) Is the above safe? Is it likely to damage my clients data?

    #3) Could there be a security risk with the default “add_post_meta” functionality?

    Kind regards,
    Lea Hayes

Viewing 1 replies (of 1 total)
  • Thanks for sharing this – I was having the same trouble. I will drop a line to wp-hacker’s list and bring back what they say.

Viewing 1 replies (of 1 total)
  • The topic ‘Bug? add_post_meta / update_post_meta’ is closed to new replies.