Support

Account

Home › Forums › Backend Issues (wp-admin) › Gallery – serialized data on update_post_meta › Reply To: Gallery – serialized data on update_post_meta

  • You are getting double serialization when updating. The reason why is that get_post_meta( $post_id ) does not universalize the data the way it would if you wanted to get a specific meta field get_post_meta( $post_id, $key ).

    So you need to maybe_unserialze the value before updating.

    
    add_post_meta( $new_post_id, $meta_key, maybe_unserialize($meta_value));